Answers for "shuffle values in array"

0

shuffle values in array

function shuffleArray(arr) {
  arr.sort(() => Math.random() - 0.5);
}
let arr = [1, 2, 3, 4, 5];
shuffleArray(arr);
console.log(arr)
Posted by: Guest on April-20-2022

Browse Popular Code Answers by Language