I think minifiers use the former because it's shorter, and thus requires less space.
the other benefit is that `void 0` cannot be overwritten in sloppy mode, whereas you can do something crazy like this:
undefined = 'lol';No you can't. You can do something like function(undefined) {}, but the global 'undefined' is non-writable and non-configurable.
That's an ES5 change. With ES3, you can overwrite NaN, Infinity, and undefined.
Only in strict mode I though no ?
Generally. Technically, it's a "breaking change".
As you can imagine, this didn't actually affect anyone.
I was curious too, so here's a jsPerf:
http://jsperf.com/check-for-undefined-argument
On Chrome 35, looks like comparing to void 0 is a bit faster. Would love some more samples though.
here says: http://www.2ality.com/2013/04/check-undefined.html void 0 is safe.