After evaluating the provided expression, the void operator returns undefined.
To obtain the undefined primitive value, the void operator is frequently used, typically with "void(0)" (which is identical to "void 0"). In these circumstances, using the global variable undefined is a better option (assuming it has not been assigned to a non-default value).
Here is an explanation: void operator.
You would want to accomplish this using a link's href because, by default, a javascript: URL will take the browser to a plain text version of the output of that JavaScript's evaluation. The browser, however, remains on the same page if the outcome is undefinable. A brief, straightforward script, void(0), evaluates to undefined.