NEW
Font size
WorksheetsConditionals in JavaScript
Total questions: 14
Worksheet time: 7mins
What checks a specific condition and performs a task based on the condition?
switch statements
operators
console.log
conditional statements
What will print to the console?
Time to buy!
Time to wait for a sale.
sale
Nothing, there is a syntax error on the fourth line
What will print to the console?
Time to buy!
Time to wait for a sale.
sale
Nothing, there is a syntax error on the fourth line
Choose the correct syntax for the strict identity operator.
=
==
===
====
Boolean is the name for a true/false value.
True
False
Which correctly matches the logical operator with its syntax?
and - !
or - | |
not - &&
and - &&
or - | |
not - !
and - | |
or - !
not - &&
and - &&
or - !
not - | |
For this conditional to be true....
day must be equal to Saturday and Sunday
day must be not equal to Saturday or Sunday
day must be equal to Saturday or Sunday
Which operator essentially takes a true value and passes back false, or takes a false value and passes back true.
&&
| |
!
??
Which is NOT an example of a falsy value?
0
NaN
empty strings
null
defined
What will print to the console?
Let us eat apples!
No apples left!
nothing, there is a syntax error because the if statement doesn't have a comparison operator
0
In a JavaScript boolean condition, what is the name for the shorter way of assigning the truthy value to a variable if you use the || operator in your assignment?
shorty evaluation
short-circuit evaluation
truthy evaluation
falsy evaluation
The if-else statement in the top image and the ternary operator in the lower image will result in the same output being logged to the console.
True
False
Else-if statements only allow for two possible outcomes.
True
False
What syntax provides an alternative and simpler way to create a conditional with a large number of else-if statements?
else-if-else statement
switch statement
case statement
break statement
