前言
Array是js中引用的数据类型,我感觉不光除了Object外,Array也是平常开发中尤为重要的一种数据类型,这篇文章我写出来,我每次写文章也是现学现卖,照葫芦画瓢罢了。边试边学。用细层面的解析来给大家讲解
先看看这个鬼东西 array所有自带的方法都是挂在Array.prototype下,先看看吧
[Symbol(Symbol.unscopables): Object]concat:concat()constructor:Array()copyWithin:copyWithin()entries:entries()every:every()fill:fill()filter:filter()find:find()findIndex:findIndex() forEach:forEach()includes:includes()indexOf:indexOf()join:join()keys:keys()lastIndexOf:lastIndexOf()length:0map:map()pop:pop()push:push()reduce:reduce()reduceRight:reduceRight()reverse:reverse()shift:shift()slice:slice()some:some()sort:sort()splice:splice()toLocaleString:toLocaleString()toString:toString()unshift:unshift()values:values()Symbol(Symbol.iterator):values()Symbol(Symbol.unscopables):Object__proto__:Object
在读这文章之前,我相信你再也找不到比这个还要细的数组祥解,痛并快乐着!!!!
js中的数组写其它语音不同之处,我分为了几点
1.可以保存任何数据类型 2.数据的长度可以动态调整
简单的举例一下上面的的两种不同之处的说法1.可以保存`任何数据`类型var array = ["ziksang",2,true,function demo(){},[1,2,4],{a:1,b:2}]console.log(array)
|