Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

Modify the function increment by adding default parameters so that it will add 1 to number if value is not specified.

const increment = (number, value = 1) => number + value;
 
console.log(increment(5, 2)); // returns 7
console.log(increment(5)); // returns 6
Comment

PREVIOUS NEXT
Code Example
Javascript :: Get rid of white space around Angular Material modal dialog 
Javascript :: filter array 
Javascript :: select option filter javascript 
Javascript :: how to loop through a map in js 
Javascript :: how to display date in javascript 
Javascript :: sum 2d array javascript 
Javascript :: mongoose get value 
Javascript :: sort array without changing the original js 
Javascript :: Uncaught ReferenceError: am4core is not defined 
Javascript :: vue js encrypt localstorage data 
Javascript :: get environment variables in node js 
Javascript :: jquery function return 
Javascript :: vue is undefined vue 3 vue.use 
Javascript :: javascript formdata 
Javascript :: sort by ascending javascript 
Javascript :: new date getday js 
Javascript :: vue router transition 
Javascript :: how to repeat string in javascript 
Javascript :: check web3 metamask disconnect 
Javascript :: regex char or char 
Javascript :: flatlist only rendering 10 items 
Javascript :: js range array 
Javascript :: render image in vue 
Javascript :: overflowy javascript 
Javascript :: javascript how to open a file 
Javascript :: stripe angular 
Javascript :: Select HTML elements by CSS selectors 
Javascript :: difference between ajax and node js 
Javascript :: tinymce adding tbale buttons 
Javascript :: component will unmount 
ADD CONTENT
Topic
Content
Source link
Name
7+3 =