javascript-if Flashcards
1
Q
Give 6 examples of comparison operators.
A
- ==
- ===
- >
- > =
- <
- <=
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 executes one set of code if a specified condition is met (TRUE) or another set of code evaluates to FALSE.
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 (condition)
- statement1
- if else (condition)
- statement2
- else
- statement3
6
Q
What are the three logical operators?
A
- &&
- ||
- !
7
Q
How do you compare two different expressions in the same condition?
A
Use the logical operator && or ||.