I have this strange problem when I shuffle an array in javascript and I have no clue what's the problem. Can somebody help me?
When I shuffle an array like this
[1,2,3,4,5,6,7,8,9,10]
I get a null value, like this
[null,10,1,8,9,3,2,7,6,4]
This is the code (http://jsfiddle.net/2m5q3d2j/):
Array.prototype.suffle = function () {
for (var i in this) {
var j = Math.floor(Math.random() * this.length);
this[i] = this[j] + (this[j] = this[i], 0);
}
return this;
};