Shuffle an Array
const nums = [1, 10, 20, 30, 50, 88];
nums.sort(() => Math.random() - 0.5);
console.log(nums);
Common way to shuffle the values in an array.
const nums = [1, 10, 20, 30, 50, 88];
nums.sort(() => Math.random() - 0.5);
console.log(nums);
Common way to shuffle the values in an array.