Answers for "js randomize array order"

11

how to randomly sort an array javascript

array.sort(() => Math.random() - 0.5);
Posted by: Guest on May-29-2021
14

js shuffle array

yourArray.sort(function() { return 0.5 - Math.random() });
Posted by: Guest on April-03-2020

Code answers related to "Javascript"

Browse Popular Code Answers by Language