About Lesson
“Question mark” or “conditional” :
operator in JavaScript is a ternary operator that has three operands.
- The expression consists of three operands: the condition, value if true and value if false.
- The evaluation of the condition should result in either true/false or a Boolean value.
- The true value lies between “?” & “:” and is executed if the condition returns true. Similarly, the false value lies after “:” and is executed if the condition returns false.
Condition:
- Expression to be evaluated which returns a Boolean value.
value if true:
- Value to be executed if condition results in true state.
value if false:
- Value to be executed if condition results in false state.
Exercise Files
No Attachment Found
Join the conversation