[JavaScript] JS数组Array 随即洗牌 →→→→→进入此内容的聊天室

来自 , 2021-03-18, 写在 JavaScript, 查看 118 次.
URL http://www.code666.cn/view/d1150905
  1. // (C) Stephen "felgall" http://www.codingforums.com/showthread.php?t=252059
  2.  
  3. Array.prototype.shuffle = function() {
  4.    var s = [];
  5.    while (this.length) s.push(this.splice(Math.random() * this.length, 1));
  6.    while (s.length) this.push(s.pop());
  7.    return this;
  8. }
  9.                                                
  10.  
  11. //javascript/136

回复 "JS数组Array 随即洗牌"

这儿你可以回复上面这条便签

captcha