I saw this code on stackoverflow about shuffling an array and wondered what it meant
const someArray = [1, 2, 3, 4, 5];
someArray.sort(() => Math.random() * 2 - 1);
Thanks
I saw this code on stackoverflow about shuffling an array and wondered what it meant
const someArray = [1, 2, 3, 4, 5];
someArray.sort(() => Math.random() * 2 - 1);
Thanks
Thank you!