有数组数组
var a = [[[1, "alpha", "a"],
[2, "beta", "b"]],
[[3, "gama", "c"]],
[[4, "delta", "d"]]];
var b = [];
1)我怎样才能合并a[0]
和a[2]
进入b
?
2)我怎样才能洗牌阵列b
?
这是我正在使用的洗牌算法>>
Array.prototype.shuffle = function() {
for (var i = 0; i < this.length; i++)
this.push(this.splice(Math.random() * (this.length - i), 1)[0]);
return this;
}
有语法
myArray.shuffle();