数组添加n个相同的元素

arr.push(...new Array(n).fill(item))

posted @ 2021-07-24 10:43  85455  阅读(404)  评论(0)    收藏  举报