javascript: suffle array (one-line script)

Here is a fantastic way to shuffle an array in javascript:

myArray.sort(function() {return 0.5 - Math.random()});

So simple yet so efficient, I love it

sources

Post a Comment

Your email is never published nor shared. You're allow to say what you want...