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.