洗牌—随机打乱数组的方法

const items = [1, 2, 3, 4, 5];

items.sort(() => (0.5 - Math.random()));

 

posted @ 2021-02-26 21:20  猫骨喵  阅读(64)  评论(0编辑  收藏  举报