×

javascript · level 1 · unit 7 · lesson 2

  1. meet it
  2. guess first
  3. your turn
  4. fix it
  5. nailed it

Tap a green word if you get lost.

meet it

A is a slot where your function catches information.

Picture your function as a machine. Right now it does the same thing every time. Cut a slot in the front, and you can feed in something new on each go.

That slot is a parameter. It is a variable that lives in the round brackets of the function, like name in function greet(name). Inside the function, use it like any other variable.

The value you drop in when you call is the . Call greet("Mia"); and name holds "Mia". Call greet("Leo"); and the same machine greets Leo instead.

function greet(name) {
  console.log(`Hello, ${name}!`);
}
greet("Mia");
greet("Leo");

Need two slots? Separate the parameters with commas, and the arguments too.