I see people write void(0)
all the time, but I don\'t understand why people use parentheses. As far as I can tell, they have no purpose. void
is no
This link explains it for you.
One thing this clarifies is that void is an operator (not a function).Because of this void(0) is technically incorrect though in practice implementations allow it to be used this way it should be used without parentheses e.g. void 0.
So its technically wrong to use void(0)
but in practise void has two different syntaxes:
void (expression)
void expression
MDN already tells you that, though no explicit statement has been made regarding the two syntaxes, as its not technically correct.
Courtesy: