let arr=[2,5,1,3,8]
arr.sort(()=>Math.random()-0.5)
//[5,2,3,1,8]
//[3,1,8,5,2]
如何随机打乱数组的元素
猜你喜欢
转载自blog.csdn.net/weixin_47389477/article/details/117998574
今日推荐
周排行