具体代码为:
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
<script>
var arr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10];
arr.sort(function (a, b) {
return Math.random() - 0.5; //使用随机数,大于0.5的往后排,小于0.5的往前排
})
console.log(arr);
</script>
</body>
</html>
index.html推荐教程:js入门教程
Copyright © 2019- wycttc.cn 版权所有
违法及侵权请联系:TEL:199 18 7713 E-MAIL:2724546146@qq.com
本站由北京市万商天勤律师事务所王兴未律师提供法律服务