Turns out the most reliable way to detect an Array is not to use the old return (typeof foo === 'object' && foo.constructor === Array) but rather to do this:
function isArray(anArray) { return Object.prototype.toString.apply(anArray) === "[object Array]"; }
No comments:
Post a Comment