企业🤖AI智能体构建引擎,智能编排和调试,一键部署,支持知识库和私有化部署方案 广告
### 方法一 ``` var temp=[]; var a=[1,2,3,4,5]; a.forEach(item=>{ temp.push(item) }) ``` ### 方法二: ``` var arr=[1,2,3,4,5] var b=[].concat(arr); console.log(b); ``` ### 方法三 ``` var arr =[1,2,3,4,5]; var b =arr.slice(0); console.log(b); ``` ### 方法四 ``` var a=[1,2,3,4,5]; var temp=[]; temp.push(...a); console.log(temp) ``` ### 方法五 ``` var a=[1,2,3,4,5]; var b=[...a]; console.log(b) ```