10 4 2 functions 2f 2f default value

Solutions on MaxInterview for 10 4 2 functions 2f 2f default value by the best coders in the world

showing results for - "10 4 2 functions 2f 2f default value"
Johanna
10 Mar 2020
1/*This example modifies the hello function to use a default value for 
2name. If name is not defined when hello is called, it will use the 
3default value.*/
4
5function hello(name = "World") {
6   return `Hello, ${name}!`;
7}
8
9console.log(hello());
10console.log(hello("Lamar"));
11
12//Hello, World!
13//Hello, Lamar!