Q28
Among the following, which one is a ternary operator?
A.
+
B.
:
C.
–
D.
?:
AnswerAnswer: 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.