我有一个四元素的数组,想将它复制四次到另一个数组中,我通过四次拼接完成了这个任务。
我的努力
let demoProperties = []
.concat(fourDemoProperties)
.concat(fourDemoProperties)
.concat(fourDemoProperties)
.concat(fourDemoProperties);
我也尝试了另一种方法(使用map和reduce),但这种方法需要迭代两次。
是否有更简单、更优的复制N次的方法?欢迎您提出任何建议。