javascript-if Flashcards
1
Q
Give 6 examples of comparison operators.
A
- > (less then);
- < (more than);
- > = (more than or equal to);
- <= (less than or equal to);
- === (strictly equal);
- !== (strictly not equal).
2
Q
What data type do comparison expressions evaluate to?
A
Boolean.
3
Q
What is the purpose of an if statement?
A
The if statement evaluates (checks) a condition.
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
Keyword if; Condition; Opening curly brace; Code to execute if value is true; Closing curly brace.
6
Q
How do you compare two different expressions in the same condition?
A
Using logical operators.