0% found this document useful (0 votes)
9 views1 page

Conditional

Uploaded by

alpana.p
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
9 views1 page

Conditional

Uploaded by

alpana.p
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Conditional (ternary) operator

Baseline Widely available

The conditional (ternary) operator is the only JavaScript operator that takes three
operands: a condition followed by a question mark (?), then an expression to execute if
the condition is truthy followed by a colon (:), and finally the expression to execute if the
condition is falsy. This operator is frequently used as an alternative to
an if...else statement.

Try it

Syntax

jsCopy to Clipboard

condition ? exprIfTrue : exprIfFalse

Parameters

condition

You might also like