Change Language


Follow Navioo On Twitter

condition ? ifTrue : ifFalse

Evaluates an expression, and does the first statement if the expression is true, or the second statement if the expression is false.

Syntax

expression ? doThisIfTrue : doThisIfFalse

Example

document.write ("Your shipping charge is " + (isExpress ? "$12.00" : "$5.00")) //Prints "$12.00" if isExpress is true, "$5.00" if it is false.

Remarks

Shortcut for the "if" statement.

text_javascript Navioo_docs

Ajax Javascript feed

↑ Grab this Headline Animator