From the MDN Docs of void
Syntax
void expression
Uses
This operator allows inserting expressions that produce side effects
into places where an expression that evaluates to undefined is
desired.
The 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).
And why? See MDN Undefined
In older versions of JavaScript undefined
could be overridden, but in starting in JavaScript 1.8.5, undefined is non-writable, as per the ECMAScript 5 specification.