Vidyalelo
JavaScript · Q28

Basic And Variables

Programming · JavaScript · question 28

Q28

Among the following, which one is a ternary operator?

A.
+
B.
:
C.
D.
?:
Answer

Answer: Option D

Solution

Answer: Option D
Solution:
A ternary operator is a conditional operator that takes three operands.

In JavaScript, ?: is the ternary operator.

It is used for conditional expressions.

The syntax is condition ? expr1 : expr2.

Options +, :, and - are not ternary operators.