Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

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)
Source by tapajyoti-bose.medium.com #
 
PREVIOUS NEXT
Tagged: #shuffle #values #array
ADD COMMENT
Topic
Name
6+2 =