转载:http://stauren.net/log/fqibpxyz3.html
var a = [];
alert(typeof a === 'object'); // true
a.constructor === Array // true
isArray: function(o) {
if (o) {
return L.isNumber(o.length) && L.isFunction(o.splice);
}
return false;
},
Object.prototype.toString.apply(value) === '[object Array]'
simple & easy, 我已经在 d-u 中加入这个方法了,相信其他 library 也会渐渐采用这个方法的。