As you will have read, the void
operator evaluates its operand and then results in the value undefined
. When you call setTimeout
, it returns a number (the timer handle). So void setTimeout(...)
results in undefined
instead of a number.
If the code is really as you've shown it, there's no purpose whatsoever to the void
operator there, because the return value from setTimeout
isn't being used for anything.
[I've removed the bit I wrote about CoffeeScript, as I couldn't create an example; the CoffeeScript compiler complained that void
is a reserved word (which it is, but that's why I was using it). I don't do CoffeeScript, so figured best to just remove that.]