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 keyword that sends data back to the calling code is ______. | return | return | |
A function returns a value to a ________. | variable | variable | |
Code a statement that passes the value of total back to the calling code. | return total; | returntotal; | |
Call the function shorten(). Include one argument, aString. Assign the returned value to an undeclared variable, clip. | let clip = shorten(aString); | letclip=shorten\(aString\); | |
Code a function with two number parameters. The function returns the result of the parameters multiplied by each other. Code the function in three lines. Make up all the names. | function multiply(num1, num2) { return num1 * num2; } |
function[a-z_$][a-zA-Z0-9_$]*\(([a-z_$][a-zA-Z0-9_$]*),([a-z_$][a-zA-Z0-9_$]*)\){[\r\n]return\1\*\2;[\r\n]} | |
Call a function with two arguments that are variables. Make up all the names. | concat(str1, str2); | [a-z_$][a-zA-Z0-9_$]*\([a-z_$][a-zA-Z0-9_$]*,[a-z_$][a-zA-Z0-9_$]*\); | |
Code a statement that returns the concatenation of two parameters. Make up the parameter names. | return string1 + string2; | return[a-z_$][a-zA-Z0-9_$]*\+[a-z_$][a-zA-Z0-9_$]*; | |
Code a function with 2 parameters. If the first parameter equals the second parmeter, return true. Make up all the names. | function compare(param1, param2) { if (param1 === param2) { return true; } } |
function[a-z_$][a-zA-Z0-9_$]*\(([a-z_$][a-zA-Z0-9_$]*),([a-z_$][a-zA-Z0-9_$]*)\){[\r\n]if\(\1===\2\){[\r\n]returntrue;[\r\n]}[\r\n]} | |
|
|||
|