JavaScript if Flashcards
1
Q
Give 6 examples of comparison operators.
A
> , =, <=, ===, and !==.
2
Q
What data type do comparison expressions evaluate to?
A
boolean
3
Q
What is the purpose of an if statement?
A
To check something and run code if it is true or 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
keyword , condition, opening curly brace, code to execute if value is true, closing curly bracket
6
Q
What are the three logical operators?
A
&&and ||or !not
7
Q
How do you compare two different expressions in the same condition?
A
Using logical operators