void is a keyword that starts an expression and returns undefined
void 0 === undefined
void (foo = 42) === undefined
How href="javascript:..." works.
if the return value is not equal to undefined.
You need to return undefined , otherwise the page will be overwritten. Using the void keyword is the easiest way to achieve this.
Raynos
source share