JavaScript Conditional Statements
JavaScript Conditional Statements - Important Points
26. | Which of the following is the correct syntax for a ternary operator in JavaScript? |
---|
A. x ? y : z;
B. x : y ? z;
C. x ? y, z;
D. x ? y || z;
View Answer Discuss Work SpaceAnswer: option a
Explanation:
27. | What is the purpose of the break statement in a switch statement? |
---|
A. To exit the switch statement
B. To execute the next case
C. To define a new case
D. To execute a default case
View Answer Discuss Work SpaceAnswer: option a
Explanation:
28. | What is the output of the following code? var x = 10; |
---|
A. x is less than 5
B. x is less than 10
C. x is greater than or equal to 10
D. No output
View Answer Discuss Work SpaceAnswer: option c
Explanation:
29. | Which of the following is a truthy value in JavaScript? |
---|
A. 0
B. null
C. 0
D. hello
View Answer Discuss Work SpaceAnswer: option d
Explanation:
30. | Which of the following is a falsy value in JavaScript? |
---|
A. 0
B. undefined
C. {}
D. 1
View Answer Discuss Work SpaceAnswer: option b
Explanation: