JS IF Flashcards
1
Q
Give 6 examples of comparison operators.
A
< less than > greater than <= greater than or equal >= less than or equal === equal !=== 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
Given a parameter the function can sort the parameter and execture code if it matches the certain aspect
4
Q
Is else required in order to use an if statement?
A
No, but only one value will be returned meaning an if is not neccessary
5
Q
Describe the syntax (structure) of an if statement.
A
if - conditional statement ( condition ) {
return ____
} else - conditonal statement return ____
6
Q
What are the three logical operators?
A
| or
&& and
! not
7
Q
How do you compare two different expressions in the same condition?
A
You can use a logical operators not! is excluded