The void operator is used to evaluate the given expression. After that, it returns undefined. It obtains the undefined primitive value, using void(0).
The void(0) can be used with hyperlinks to obtain the undefined primitive value
As shown above, the code will only work when the button will be clicked twice. If it is clicked once, then nothing happens. But the alert box comes over when the button is clicked twice since we used the ondblclick event handler.