打乱一个数组

const shuffle = (arr) => {
    
    
  return arr.sort(() => {
    
    
    return Math.random() > 0.5 ? 1 : -1
  })
}

猜你喜欢

转载自blog.csdn.net/qiaoqiaohong/article/details/123520433