typeof操作符可以区分函数和其他操作对象。
function isArrayFn(value) {
if (typeof Array.isArray === "function") {
return Array.isArray(value);
} else {
return Object.prototype.toString.call(value) === "[object Array]";
}
}
console.log(isArrayFn(arrTmp));
console.log(isArrayFn(obj));