Function Parameters
Parameters are names in the function definition. Defaults handle arguments that are omitted or undefined.
Where to run this
This example uses the JavaScript console playground. Select Run to execute it; the example does not run on this lesson page.
A practical example
function welcome(name = "visitor") {
return "Welcome, " + name;
}
console.log(welcome());
What happens
The default produces Welcome, visitor.