1
2
3
4
5
6
7
8
9
10
To practice on your own, or to check code you believe shouldn't have been scored as incorrect, go to CodePen.
0,1,2,3,4,5,6,7,8,9
0
0
0
0
The variables in a function definition that receive the data passed to them by the calling code are called _________. | parameters | parameters | |
The rules for naming parameters are the same as the rules for naming ______. | variables | variables | |
Code a call to the function displayAlert() that passes the argument "Hello world" | displayAlert("Hello world"); | displayAlert\(•Helloworld•\); | |
Code the first line of a function named concat(). It has 3 parameters—the first three letters of the alphabet—all strings. | function concat("a", "b", "c") { | functionconcat\(•a•,•b•,•c•\){ | |
Code a function call that has a variable, a string, and a number as arguments. Make up the name of the function and the arguments. | makeAddress(city, "Texas", 24); | [a-z_$][a-zA-Z0-9_$]*\([a-z_$][a-zA-Z0-9_$]*,•.*,[-]?(?:[.]\d+|\d+(?:[.]\d*)?)\); | |
Code the first line of a function that has 2 parameters. Make up the name of the function and the parameters. | function combineNames(firstName, lastName) { | function[a-z_$][a-zA-Z0-9_$]*\([a-z_$][a-zA-Z0-9_$]*,[a-z_$][a-zA-Z0-9_$]*\){ | |
Code a function that has 2 parameters. Concatenate them and assign the result to a variable that hasn't been declared beforehand. Make up all the names. | function concat(string1, string2) { let combo = string1 + string2; } |
function[a-z_$][a-zA-Z0-9_$]*\(([a-z_$][a-zA-Z0-9_$]*),([a-z_$][a-zA-Z0-9_$]*)\){[\r\n]letcombo=\1\+\2;[\r\n]} | |
Code a function that has three number parameters. Multiply them. Assign them to a variable that hasn't been declared beforehand. Make up all the names. | function mult(a, b, c) { let num = a * b * c; } |
function[a-z_$][a-zA-Z0-9_$]*\(([a-z_$][a-zA-Z0-9_$]*),([a-z_$][a-zA-Z0-9_$]*),([a-z_$][a-zA-Z0-9_$]*)\){[\r\n]let[a-z_$][a-zA-Z0-9_$]*=\1\*\2\*\3;[\r\n]} | |
|
|||
|