There's easier ways to shuffle an array
var myArray = ['Ace',2,3,4,5,6,7,8,9,10,'Jack','Queen','King'];
Code:
Array.prototype.shuffle= function(){
return this.sort(function(){
return 0.5 - Math.random();
})
}
alert(myArray.shuffle())
Code:
Array.prototype.disorder= function(){
var i, temp, L= this.length, A= this.concat();
while(--L){
i= Math.floor(Math.random()*L);
temp= A[i];
A[i]= A[L];
A[L]= temp;
}
return A;
}
alert(myArray.disorder());