An expression that evaluates to a Boolean is always placed to the left of the question mark (?) in the Conditional Operator.
If the expression evaluates to true, the value between the question mark and the colon (:) is returned.
If the expression evaluates to false, the value following the colon is returned.
<html>
<SCRIPT LANGUAGE="JavaScript">
<!--
mailFlag = "YES"
var message1;
var message2;
if (mailFlag == "YES"){
message1 = "A";
}else{
message1 = "B";
}
//Same statement using conditional operator
message2 = (mailFlag == "YES") ? "A" : "B";
document.write("The if statement returns: ",message1,"<BR>");
document.write("The conditional operator returns: ",message2);
-->
</SCRIPT>
</html>