|Property/method value type:||Depends on arguments|
|Argument list:||aCondition||A relational or logical expression that yields true or false|
|moreCode||Code that is executed if aCondition is false|
|someCode||Code that is executed if aCondition is true|
The two associated code blocks are executed according to the value yielded by a Boolean test on the first operand. If it is true, then the first code block is executed, otherwise the second is used.
The associativity is right to left.
Refer to the Operator Precedence topic for details of execution order.
This is sometimes called a Ternary operator, because it takes three operands.
<HTML> <HEAD></HEAD> <BODY> <SCRIPT> mySwitch = false; myResult = (mySwitch) ? "TRUE VALUE" : "FALSE VALUE" ; document.write(myResult); </SCRIPT> </BODY> </HTML>