Functions – Parameters, online
Six activities your students do on their own devices. See who's finished, and their scores.
Learning
Understanding
Testing
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 ].
PREVIOUS · MODULE 38Functions – Declaring
YOU ARE HERE · MODULE 39Functions – Parameters
NEXT · MODULE 40Functions – Return Values
What students will learn in this module
Every question in Module 39
Quick questions
- Do function parameters let you pass values into a function?AYesBNo
- Are multiple parameters separated by commas?ANoBYes
- Is a parameter treated as a variable inside the function?AYesBNo
- Is (a b) valid syntax for declaring two parameters?ANoBYes
- 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 doesfunction add(a, b) { ... }Match it to what it doesHolds the value passed in when a function is calledMatch it to what it doesSeparates multiple parameters in a function declarationMatch it to what it doesfunction add(a b) { ... }Match it to what it doesFunction greet(name) { ... }Match it to what it doesFill in the blanks
function greet(____) {Hint: Type the parameter name declared inside the parentheses.
function add(a, _) {Hint: Type the second parameter name.
function multiply(x, _) {Hint: Type the second parameter name.
console.log(a _ b);
Hint: Type the operator used to add the two parameters.
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]
