Functions – Parameters, online

Six activities your students do on their own devices. See who's finished, and their scores.

Functions – Parameters in one minute

What students need to know

The parameter name stores whatever value is passed to it. A comma divides one parameter from the next.

Parameters act as inputs the function can use. Each parameter in the list is separated by a comma.

Mistakes students make

  • 'function' must be lowercase - a capital F causes an error.
  • Multiple parameters need a comma between them: (a, b).
  • This line is missing a semicolon, but that's not required in JS.
  • The block must close with }, not ].

Discover other journeys with this module

What students will learn in this module

Every question in Module 39

Quick questions

  1. Do function parameters let you pass values into a function?AYesBNo
  2. Are multiple parameters separated by commas?ANoBYes
  3. Is a parameter treated as a variable inside the function?AYesBNo
  4. Is (a b) valid syntax for declaring two parameters?ANoBYes
  5. Must parameters be listed inside the function's parentheses?ANoBYes

Key terms

Students type the meaning of:

  • parameter

Match the pairs

function greet(name) { ... }Match it to what it does
function add(a, b) { ... }Match it to what it does
Holds the value passed in when a function is calledMatch it to what it does
Separates multiple parameters in a function declarationMatch it to what it does
function add(a b) { ... }Match it to what it does
Function greet(name) { ... }Match it to what it does

Fill in the blanks

  1. function greet(____) {

    Hint: Type the parameter name declared inside the parentheses.

  2. function add(a, _) {

    Hint: Type the second parameter name.

  3. function multiply(x, _) {

    Hint: Type the second parameter name.

  4. console.log(a _ b);

    Hint: Type the operator used to add the two parameters.

  5. function introduce(____, age) {

    Hint: Type the first parameter name.

Spot the error

Question 1

AFunction greet(name) {Bconsole.log(name);C}

Question 2

Afunction add(a b) {Bconsole.log(a + b);C}

Question 3

Afunction sub(a, b) {Bconsole.log(a - b)C}

Question 4

Afunction mult(x, y) {Bconsole.log(x * y)C}

Question 5

Afunction greet(name) {Bconsole.log(name);C]