JS中怎么判断对象是否为数组的方法
原创var arr2 = [{ abac : 1, abc : 2 }];
function isArrayFn(value){
if (typeof Array.isArray === "function") {
return Array.isArray(value);
}else{
return Object.prototype.toString.call(value) === "[object Array]";
}
}
alert(isArrayFn(arr));// true
alert(isArrayFn(arr2));// true
摘自: https://www.cnblogs.com/heshan1992/p/6927690.htm
版权声明
所有资源都来源于爬虫采集,如有侵权请联系我们,我们将立即删除