Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

10.4.3. Arguments Are Optional // Functions

/*Just as it is possible to call a function with fewer arguments than it 
has parameters, we can also call a function with more arguments than it 
has parameters. In this case, such parameters are not available as a 
named variable.

This example calls hello with two arguments, even though it is defined 
with only one parameter.*/

function hello(name = "World") {
   return `Hello, ${name}!`;
}

console.log(hello("Jim", "McKelvey"));
Source by education.launchcode.org #
 
PREVIOUS NEXT
Tagged: #Arguments #Are #Optional #Functions
ADD COMMENT
Topic
Name
1+5 =