巴州住房和城乡建设局网站,百度抓取网站登录,需要做个网站,租网站服务器一个月多少钱js中判断数组的方式有哪些#xff1f;1.通过Object.prototype.toString.call来判断2.通过instanceof来判断3.通过constructor来判断4.通过原型链来判断5.通过ES6.Array.isAaary()来判断6.通过Array.prototype.isPrototypeOf来判断1.通过Object.prototype.toString.call来判断 …
js中判断数组的方式有哪些1.通过Object.prototype.toString.call来判断2.通过instanceof来判断3.通过constructor来判断4.通过原型链来判断5.通过ES6.Array.isAaary()来判断6.通过Array.prototype.isPrototypeOf来判断1.通过Object.prototype.toString.call来判断 console.log(Object.prototype.toString.call([1,2,3])); //[object Array]2.通过instanceof来判断
console.log([1,2,3] instanceof Array); //true3.通过constructor来判断
console.log(([1,2,3].constructor Array));//true4.通过原型链来判断
console.log([1, 2, 3].__proto__ Array.prototype); //true5.通过ES6.Array.isAaary()来判断
console.log(Array.isArray([1, 2, 3]));//true6.通过Array.prototype.isPrototypeOf来判断
console.log(Array.prototype.isPrototypeOf([1, 2, 3]));//true