Function parameters part 2

Using Parameters



After defining the parameters, you can use them inside the function.
function sayHello(name) {
alert("Hi, " + name);
}

sayHello("David");
//Alerts "Hi, David"
Try It Yourself

This function takes in one parameter, which is called name. When calling the function, provide the parameter's value (argument) inside the parentheses. 
Function arguments are the real values passed to (and received by) the function

Comments

Popular posts from this blog

Comparison Operators part 2

Break and Continue part 1

Module 2