javascript数组快速打乱重排的方法
作者:用户投稿 浏览: 发布日期:2026-01-16
[导读]:本文介绍了利用Array.prototype.sort方法和Math.random()实现快速打乱数组的方法,大家参考使用吧
复制代码 代码如下:
var arr = [1,2,3,4,5,6,7,8,9,10];
var out = arr.sort(function(){
return Math.random() > 0.5;
}
免责声明:转载请注明出处:http://shjed.com/news/256282.html