Unlike python javascript does not have Array.prototype.shuffle()
method.
So I implemented like below:
var arr = [1, 2, 3, 4, 5];
arr.sort((a, b)=> Math.random() * 2 - 1); //simple shuffle
console.log(arr);
I don't know whether this code is safe enough to use.