JavaScript If Flashcards
1
Q
Give 6 examples of comparison operators.
A
Strictly equal to ===, strictly not equal to !==, greater than >, less than =, less than or equal to <=
2
Q
What data type do comparison expressions evaluate to?
A
Boolean
3
Q
What is the purpose of an if statement?
A
Checks a condition for a boolean and runs code based on the boolean
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
The keyword ‘if’, a conditional expression, a code block if the condition equates true
6
Q
What are the three logical operators?
A
Logical and &&, Logical or ||, logical not !
7
Q
How do you compare two different expressions in the same condition?
A
Using a Logical operator