Which of the following operators is a ternary one?
- An assignment operator
=
. - A conditional operator
? :
. - A typeof operator.
- An increment operator
++
.
Explanation & Hint:
The ternary operator in JavaScript is represented by the ? and : symbols. It is the only ternary operator in JavaScript. The ternary operator takes the following form: condition ? expression1 : expression2 It evaluates the condition and returns expression1 if the condition is truthy, or expression2 if the condition is falsy. |