let arr = [1, 2, 3]
console.log(arr instanceof Array);
console.log('==================');
console.log(Array.isArray(arr));
console.log('==================');
console.log(Object.getPrototypeOf(arr) === Array.prototype);
// console.log(arr.__proto__ === Array.prototype);
// console.log(Object.is(arr.__proto__, Array.prototype));
console.log('==================');
console.log(Object.prototype.toString.call(arr).includes("Array"));
console.log('==================');
console.log(arr.constructor === Array);
console.log('==================');
console.log(Array.prototype.isPrototypeOf(arr));
console.log('==================');
JavaScript 检测数组的6钟方法
最新推荐文章于 2024-11-02 12:42:04 发布