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
What keyword specifies a statement or statements to be executed when all tests above have failed? | else | else | |
What are the keywords that test for a condition when an if test has failed? | else if | elseif | |
Code an else statement that displays an alert saying "Incorrect". | else { alert("Incorrect"); } |
else{[\r\n]alert\(•Incorrect•\);[\r\n]} | |
Code an else if statement that tests whether a has the same value as b. If so, display an alert that says "OK". | else if (a === b) { alert("OK"); } |
elseif\(a===b\){[\r\n]alert\(•OK•\);[\r\n]} | |
Code an else statement that assigns the value of one variable to another. Make up the variable names. | else { num2 = num1; } |
else{[\r\n][a-z_$][a-zA-Z0-9_$]*=[a-z_$][a-zA-Z0-9_$]*;[\r\n]} | |
Code the first line of a statement, that, if tests above it fail, checks whether one variable doesn't equal another. Make up the variable names. | else if (a !== b) { | elseif\([a-z_$][a-zA-Z0-9_$]*!==[a-z_$][a-zA-Z0-9_$]*\){ | |
Code an if statement that tests whether a variable's value is greater than or equivalent to another variable's value. If so, display an alert. If not, display a different alert. Make up everything. | if (a >= b) { alert("OK"); } else { alert("Not OK"); } |
if\([a-z_$][a-zA-Z0-9_$]*>=[a-z_$][a-zA-Z0-9_$]*\){[\r\n]alert\(•.*•\);[\r\n]}else{[\r\n]alert\(•.*•\);[\r\n]} | |
Code an if statement that tests whether a variable's value is less than another variable's value. If so, display an alert. If not, test whether the first variable's value is greater than the second variable's value. If so, display a different alert. Make up everything. | if (a < b) { alert("Smaller"); } else if (a > b) { alert("Bigger"); } |
if\(([a-z_$][a-zA-Z0-9_$]*)<([a-z_$][a-zA-Z0-9_$]*)\){[\r\n]alert\(•.*•\);[\r\n]}elseif\(\1>\2\){[\r\n]alert\(•.*•\);[\r\n]} | |
|
|||
|