Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PHP

function default value

function multiply(a, b = 1) {
  return a * b
}

multiply(5, 2)          // 10
multiply(5)             // 5
multiply(5, undefined)  // 5
Source by developer.mozilla.org #
 
PREVIOUS NEXT
Tagged: #function #default
ADD COMMENT
Topic
Name
9+1 =