JavaScript Conditional Statements
JavaScript Conditional Statements - Important Points
| 1. | What is a conditional statement in JavaScript? |
|---|
A. A statement that is always executed
B. A statement that is executed only if a certain condition is met
C. A statement that is executed multiple times
D. A statement that defines a function
View Answer Discuss Work SpaceAnswer: option b
Explanation:
A conditional statement is a statement that is executed only if a certain condition is true.
| 2. | Which of the following is a comparison operator in JavaScript? |
|---|
A. !
B. ||
C. ==
D. *
View Answer Discuss Work SpaceAnswer: option c
Explanation:
| 3. | Which of the following is a logical operator in JavaScript? |
|---|
A. +
B. /
C. &&
D. %
View Answer Discuss Work SpaceAnswer: option c
Explanation:
| 4. | What is the purpose of the else statement in a conditional statement? |
|---|
A. To provide an alternative condition to check
B. To define a function
C. To perform a specific action
D. To end the conditional statement
View Answer Discuss Work SpaceAnswer: option a
Explanation:
| 5. | What is the purpose of the if statement in a conditional statement? |
|---|
A. To provide an alternative condition to check
B. To define a function
C. To perform a specific action
D. To execute a block of code only if a certain condition is true
View Answer Discuss Work SpaceAnswer: option d
Explanation: