10.4.3. Arguments Are Optional // Functions
/*A function may be defined with several parameters, or with no
parameters at all. Even if a function is defined with parameters,
JavaScript will not complain if the function is called without
specifying the value of each parameter.*/
function hello(name) {
return `Hello, ${name}!`;
}
console.log(hello());
//Hello, undefined!
/*We defined hello to have one parameter, name. When calling it,
however, we did not provide any arguments. Regardless, the program ran
without error.
Arguments are optional when calling a function. When a function is
called without specifying a full set of arguments, any parameters that
are left without values will have the value undefined.*/