The void operator is used to set to execute the expression without returning any values. Let's take a look:
Save and load this code and you will notice that the variable aNumber is assigned the value undefined.
The Ternary Operator :?
This operator is called the ternary conditional operator. To understand why they call it conditional you need to take a look at its three operands. The first operand is a boolean expression. When it evaluates to true the statement in the second operand gets executed, and when it evaluates to false the statement in the third operand get executed. It takes the form
boolean expression ? the true statement : the false statement ;
Note that we can't put the semicolon after the second operand because the colon symbol (:) in the operator separates the second and the third operand. If you put in the semicolon you will get an error; you need to put a semicolon at the third operand. Let's take a look at an example:
Save and load the above code and you will get this result.
It's very simple, the expression x < 10 && x > 5 is evaluated, and if it's true then the second operand is executed, which writes to the Web page the string "Yes, x is less than 10." If the expression evaluated to false, then the third operand is executed (not the second one).