Section 1 - Instruction

Last time, we created functions that did the exact same thing every time. But what if we could make them more flexible? What if we could give our functions information to work with when we call them?

Engagement Message

How could we make our sayHello() function greet different people by name?

Section 2 - Instruction

We can do this with parameters. Parameters are variables that act as placeholders for values you'll provide when you call the function.

Think of them as the empty slots in a form that you need to fill out.

Engagement Message

What parameter might our sayHello() function include?

Section 3 - Instruction

Parameters go inside the parentheses when we define a function. Here's how we add a parameter called name to our greeting function:

Engagement Message

Notice the name variable inside the parentheses?

Section 4 - Instruction

Now when we call this function, we pass a value, called an argument, inside the parentheses. This argument becomes the value of the parameter inside the function for that specific call.

Engagement Message

See how the same function produces different outputs?

Section 5 - Instruction
Sign up
Join the 1M+ learners on CodeSignal
Be a part of our community of 1M+ users who develop and demonstrate their skills on CodeSignal