A function does two things normally: do something and return a value. Some functions perform only one of these things, some do both. For example, the function:
function square(x) { return x * x; }
It is a side effect since everything that it does returns a value, and its call can always be replaced by its return value. On the other hand, something like alert() is called only for its side effects (warning the user) and never for the return value.
So, what the void operator does is make JavaScript ignore the return value and indicate that all you are interested in are side effects of the function.
source share