Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

how to shuffle an array in js

const array = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10];
const shuffledArray = array.sort((a, b) => 0.5 - Math.random());
Source by dev.to #
 
PREVIOUS NEXT
Tagged: #shuffle #array #js
ADD COMMENT
Topic
Name
7+6 =