Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

Default parameter

 
function addNum(a=0, b=0) {
    return a + b ;
}
 
 
console.log(addNum());              //1
console.log(addNum(1));             //1
console.log(addNum(1,2));           //3
 
Source by www.tektutorialshub.com #
 
PREVIOUS NEXT
Tagged: #Default #parameter
ADD COMMENT
Topic
Name
5+2 =