10 4 2 parameters and arguments c2 b6 2f 2f functions

Solutions on MaxInterview for 10 4 2 parameters and arguments c2 b6 2f 2f functions by the best coders in the world

showing results for - "10 4 2 parameters and arguments c2 b6 2f 2f functions"
Jaelynn
23 May 2016
1/*The function hello takes a single value, which we expect to be a 
2person's name, and returns a message that greets that person.*/
3
4function hello(name) {
5   return `Hello, ${name}!`;
6}
7
8console.log(hello("Lamar"));
9
10//Hello, Lamar!
11
12
13/*In this example, name is a parameter. It is part of the function 
14definition, and behaves like a variable that exists only within the
15function.
16
17The value "Lamar" that is used when we invoke the function on line 5 is
18an argument. It is a specific value that is used during the function 
19call.
20
21The difference between a parameter and an argument is the same as that
22between a variable and a value. A variable refers to a specific value,
23just like a parameter refers to a specific argument when a function 
24is called. Like a value, an argument is a concrete piece of data.*/
similar questions