Conditionals Flashcards

1
Q

What are conditional statements?

A

Conditional statements are used to perform different actions based on different conditions.

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

What is an “ if “ statement?

A

An if statement is used to specify a block of JavaScript code to be executed if a condition is true.

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

What is an “ else “ statement?

A

An else statement is used to specify a block of code to be executed if the condition is false.

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

What is an “ else if “ statement?

A

An else if statement is used to specify a new condition if the first condition is false.

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

What is a “ switch “ statement?

A

A switch statement is used to select one of many code blocks to be executed.

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

What is a “ ternary “ operator?

A

A conditional operator that assigns a value to a variable based on some condition.

Syntax:
variable name = (condition) ? value1:value2

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