News for hackers. Stuff that matters.
Re:V8 Optimization Killers by ttty on Wednesday June 25, 2014 @09:31AM (#7943730)
Which is better `undefinedVar === void 0` or `typeof undefinedVar === 'undefined'`?

here says: http://www.2ality.com/2013/04/check-undefined.html void 0 is safe.

Re:V8 Optimization Killers by ekmartin on Wednesday June 25, 2014 @09:56AM (#7943848)
I think minifiers use the former because it's shorter, and thus requires less space.
Re:V8 Optimization Killers by phpnode on Wednesday June 25, 2014 @10:12AM (#7943958)
the other benefit is that `void 0` cannot be overwritten in sloppy mode, whereas you can do something crazy like this:

    undefined = 'lol';
Re:V8 Optimization Killers by evilpie on Wednesday June 25, 2014 @11:13AM (#7944442)
No you can't. You can do something like function(undefined) {}, but the global 'undefined' is non-writable and non-configurable.
Re:V8 Optimization Killers by ahoge on Wednesday June 25, 2014 @11:28AM (#7944544)
That's an ES5 change. With ES3, you can overwrite NaN, Infinity, and undefined.
Re:V8 Optimization Killers by LunaSea on Wednesday June 25, 2014 @07:00PM (#7947251)
Only in strict mode I though no ?
Re:V8 Optimization Killers by ahoge on Wednesday June 25, 2014 @07:44PM (#7947391)
Generally. Technically, it's a "breaking change".

As you can imagine, this didn't actually affect anyone.

Re:V8 Optimization Killers by kibibu on Wednesday June 25, 2014 @08:00PM (#7947446)
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.