What is the use of Void(0)?
The
void
operator evaluates the given expression and then returnsundefined
.The
void
operator is often used merely to obtain theundefined
primitive value, usually using “void(0)
” (which is equivalent to “void 0
”). In these cases, the global variableundefined
can be used instead (assuming it has not been assigned to a non-default value).