javascript-if Flashcards

1
Q

Give 6 examples of comparison operators.

A

== , ===, < , > , !=. !==

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

to compare an expression. Based on the result of that comparison the code will execute one or more statements else the code does something different or just skips the step.

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

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

keyword ‘if’ followed by the condition in paranthesis folowed by an opening curly brace then the code to execute if value is true and a closing curly brace.

if ( {condition} ) {
//Code to be executed if true
}

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

by using a logical operator between them or an else if statement

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