JS If Flashcards
1
Q
Give 6 examples of comparison operators.
A
< > <= => == === !=
2
Q
What data type do comparison expressions evaluate to?
A
boolean (i.e. true or false)
3
Q
What is the purpose of an if statement?
A
Evaluates a condition or expression
4
Q
Is else required in order to use an if statement?
A
No
5
Q
Describe the syntax (structure) of an if statement.
A
if (keyword) (condition) {
(code to execute if the value is true);
}
6
Q
What are the three logical operators?
A
&&
||
!
7
Q
How do you compare two different expressions in the same condition?
A
parentheses and a logical operator