News for hackers. Stuff that matters.
Re:Why You Should Always Use === and Other Bad Practices by dcherman on Sunday February 09, 2014 @05:54PM (#7207775)
That code snippet is also using a faulty technique for identifying an Array. Although it will work for the majority of cases, if you're using an array from a different iframe, the instanceof check will fail since the Array constructors are not the same.

You should be using Array.isArray ( ES5 compatible browsers ), or Object.prototype.toString.call( obj ) === '[object Array].

Lodash, Underscore, and jQuery all provide utility methods to do that comparison for you.

Re:Why You Should Always Use === and Other Bad Practices by inglor on Sunday February 09, 2014 @06:50PM (#7208068)
Should probably do `.length` to detect it's iterable and not do a type check since that's an anti pattern anyway.
Re:Why You Should Always Use === and Other Bad Practices by underwater on Sunday February 09, 2014 @08:12PM (#7208459)
That would happily accept and iterate over a string, which wouldn't be desirable.