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.
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.