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
Call this function, assigning the returned value to a variable that hasn't been declared beforehand. Make up the name of the variable. | function returnADozen() { return 12; } |
let num = returnADozen(); | let[a-z_$][a-zA-Z0-9_$]*=returnADozen\(\); |
Assign this function to a variable. Then call the function using the variable. Make up the name of the variable. | function sayHi() { alert("Hi"); } |
const aVar = sayHi; aVar(); |
const([a-z_$][a-zA-Z0-9_$]*)=sayHi;[\r\n]\1\(\); |
Rewrite this code using a shorthand arrow function. | const aVar = function() { alert("Hi"); }; aVar(); |
const aVar = () => alert("Hi"); aVar(); |
constaVar=\(\)=>alert\(•Hi•\);[\r\n]aVar\(\); |
Given the following code, the alert will display "____" | function outerFunction() { function innerFunction() { alert("Hi"); } return innerFunction; } const aVar = outerFunction(); aVar(); |
Hi | •?Hi•? |
Given the following code, what is the value of aVar? | function outerFunction() { function innerFunction() { alert("Hi"); } return innerFunction; } const aVar = outerFunction(); |
innerFunction | innerFunction |
Fill in the blank so the alert displays "Hi". Include the indentation. | function outerFunction() { function innerFunction() { alert("Hi"); } ______________ } const aVar = outerFunction(); aVar(); |
return innerFunction; | returninnerFunction; |
Fill in the blanks so the alert displays "Hi". Make up the name of the inner function. | function outerFunction() { ___________________ __________ __ ________________ } const aVar = outerFunction(); aVar(); |
function innerFunction() { alert("Hi"); } return innerFunction; |
function([a-z_$][a-zA-Z0-9_$]*)\(\){[\r\n]alert\(•Hi•\);[\r\n]}[\r\n]return\1; |
Code a function that defines a second function and returns the name of the second function. The second function doesn't do anything. Make up the names. | function outerFunction() { function innerFunction() { } return innerFunction; } |
function[a-z_$][a-zA-Z0-9_$]*\(\){[\r\n]function([a-z_$][a-zA-Z0-9_$]*)\(\){[\r\n]}[\r\n]return\1;[\r\n]} | |
|
|||
|