void operator evaluates the given
expression and then returns
This operator allows inserting expressions that produce side effects into places where an expression that evaluates to
undefined is desired.
void operator is often used merely to obtain the
undefined primitive value, usually using "
void(0)" (which is equivalent to "
void 0"). In these cases, the global variable undefined can be used instead (assuming it has not been assigned to a non-default value).
When a browser follows a
void operator can be used to return
undefined. For example:
Note, however, that