The conditional (ternary) operator is the only JavaScript operator that takes three operands. This operator is frequently used as a shortcut for the if statement.
Syntax
condition ? expr1 : expr2
condition (or conditions)
- An expression that evaluates to
true
orfalse
.
expr1
,expr2
- Expressions with values of any type.
How to use Conditional (ternary) Operator - part 4
Reviewed by Viththiyakaran
on
12:09 AM
Rating:

No comments: