[JS] Random Soring Array
This is to sort elements in an array random orders.
const points = [40, 100, 1, 5, 25, 10];
const result = points.sort(function(a, b){return 0.5 - Math.random()});
console.log(result);
This is to sort elements in an array random orders.
const points = [40, 100, 1, 5, 25, 10];
const result = points.sort(function(a, b){return 0.5 - Math.random()});
console.log(result);
Comments