10.4.2. Functions // Default Value
/*This example modifies the hello function to use a default value for
name. If name is not defined when hello is called, it will use the
default value.*/
function hello(name = "World") {
return `Hello, ${name}!`;
}
console.log(hello());
console.log(hello("Lamar"));
//Hello, World!
//Hello, Lamar!