Javascript-if Flashcards

1
Q

Give 6 examples of comparison operators.

A

”>” greater than, “>=” greater or equal to, “==”equal to, “===” strictly equal to, “!=” is not equal to, “!==”strictly not equal to.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What data type do comparison expressions evaluate to?

A

boolean

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What is the purpose of an if statement?

A

the purpose is decision making. an if statement evaluates conditions and determine which code should be run.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Is else required in order to use an if statement?

A

no, if you only need the code to run when the if statement returns true, and do nothing else when the condition is false, then the else statement is not needed.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Describe the syntax (structure) of an if statement.

A

it starts with if, followed by parentheses, and inside of parentheses, there usually two operands being compared. and after the closing parenthesis, there would be the curly braces with the conditional statement.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What are the three logical operators?

A

&& logical and, || logical or, ! logical not.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

How do you compare two different expressions in the same condition?

A

you can use parentheses for each expression and connect them with logical operators.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly