| ?: (Conditional) This operator fulfills the same functionality as an if / else statement, but in a kind of shorthanded form. An expression that evaluates to a boolean (true or false) must be placed to the left of the questionmark. If the expression evaluates to true, the first value after the questionmark is returned from the operation. If the expression evaluates to false, the value after the colon is returned from the operation. syntax: expression ? valueOne : valueTwo EXAMPLE var x = new String("67"); if (x < 100) ? document.write("The result is true") : document.write("The result is false"); The example is a simple instance of the conditional operator that compares two numbers. If the condition (x < 100) is true, the first statement is executed, in this case a document.write statement. If the condition is false, the second document.write statement will be executed. |