Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

js named parameters

myFunction({ param1 : 70, param2 : 175});

function myFunction({param1, param2}={}){
  // ...function body...
}

// Or with defaults, 
function myFunc({
  name = 'Default user',
  age = 'N/A'
}={}) {
  // ...function body...
}
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #js #named #parameters
ADD COMMENT
Topic
Name
7+1 =