Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

js default parameter

function greeting (name = 'stranger') {
  console.log(`Hello, ${name}!`)
}

greeting('Nick') // Output: Hello, Nick!
greeting() // Output: Hello, stranger!
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #js #default #parameter
ADD COMMENT
Topic
Name
4+5 =