多应用+插件架构,代码干净,二开方便,首家独创一键云编译技术,文档视频完善,免费商用码云13.8K 广告
[TOC] ## 1.数组克隆 ``` var a = [1,2,3,4] var b = [] b = b.concat(a) //1 b = a.slice(0) //2 b = [...a] //3 b.push(...a) //4 console.log(b) ``` ##2.数组遍历 ``` var a = [1,2,3,4] var b = [] a.forEach(element => { b.push(element) }); for (let i in a) { b.push(a[i]) } for (let i of a) { b.push(i) } a.map(e=>{ b.push(e) }) Array.from(a,e=>{ b.push(e) }) ```