30 ms·
in ES5: Array.isArray(['one', 'two']) === true Until then, you can use a polyfill such as ES5-Shim[1], another library such as Underscore.js[2] or even so
by jameswyse 14y ago
in ES5:
Array.isArray(['one', 'two']) === true
Until then, you can use a polyfill such as ES5-Shim[1], another library such as Underscore.js[2] or even something simple like this:
if(!Array.isArray) {
Array.isArray = function (vArg) {
return Object.prototype.toString.call(vArg) === "[object Array]";
};
}
[1] https://github.com/kriskowal/es5-shim https://github.com/kriskowal/es5-shim
[2] http://underscorejs.org/#isArray http://underscorejs.org/#isArray