1 // 扩展运算符(...)
2 let a = [1,2,3,4]
3 let b = [5,6,7,8]
4 let c = [9,10,11,12]
5 let d = '1'+'2'+'3'
6 // 将数组转为一个参数序列
7 console.log(...a)
8 // 将b添加在a的尾部
9 a.push(...b)
10 console.log(a)
11 // 合并数组
12 console.log([...b,...c])
13 // 结合Math方法求最大值
14 console.log(Math.max(...a))
15 // 将字符串转为数组
16 console.log([...d])
17 // Array.of将一组值或字符串转为数组
18 console.log(Array.of('3',4,5))
19 // find()找到符合条件的成员,value为当前值,index为所在索引,arr为原数组
20 a.find((value,index,arr)=>{
21 if(value < 4) console.log(value,index)
22 })
23 // findIndex()找到符合条件的成员,value为当前值,index为所在索引,arr为原数组
24 a.findIndex((value,index,arr)=>{
25 if(value < 4) console.log(value,index)
26 })