码迷,mamicode.com
首页 > 编程语言 > 详细

随机数组

时间:2018-12-14 17:42:43      阅读:175      评论:0      收藏:0      [点我收藏+]

标签:nbsp   随机   随机数组   dom   数组   function   mat   排列   ret   

1、随机排序数组

var arr = [10,5,40,25,80,1]

arr.sort(function(a,b)

{

  return a-b

})

)

 

2、按照大小排列数组

var arr = [10,5,40,25,80,1]

arr.sort(function(a,b)

{

return Math.random()-0.5

})

)

随机数组

标签:nbsp   随机   随机数组   dom   数组   function   mat   排列   ret   

原文地址:https://www.cnblogs.com/Ella2018/p/10119646.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!