Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR 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
 
PREVIOUS NEXT
Tagged: #Modify #function #increment #adding #default #parameters #add #number
ADD COMMENT
Topic
Name
9+4 =