实现数组随机排序(shuffle) var shuffle = function (array) { let res = [], random; while(array.length){ random = Math.floor(Math.random()*array.length); res.push(array[random]); array.splice(random, 1); } return res; } 使用示例“ 效果: