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
One type of local scope is block scope. The other type of local scope is _______ scope. | function | function | |
Block scope has meaning only inside the _______. | block | block | |
A variable that has meaning everywhere has ______ scope. | global | global | |
In the following code, i has _______ scope. | let (i = 0; i < 12; i++) { | block | block |
In the following code, which line won't work? Answer with a numeral, like 1. | 1. for (let i = 0; i < numbers.length; i ++) { 2. let firstNumber = numbers[i]; 3. break; 4. } 5. let total = 10 + firstNumber; |
5 | 5 |
In the following code, num has _______ scope. | function x() { let num = 1; } |
function | function |
In the following code, y has ______ scope. | let x = y => y; let z = x(12); |
function | function |
Code an if statement that tests whether a global variable has a certain integer value. Within the statement, create an integer variable that has block scope. Use const. Make up everything. | if (x === 1) { const z = 0; } |
if\([a-z_$][a-zA-Z0-9_$]*===(0|-?[1-9][\d]*)\){[\r\n]const[a-z_$][a-zA-Z0-9_$]*=(0|-?[1-9][\d]*);[\r\n]} | |
|
|||
|