for this I use the
but it can be changed using a compare function inside parameters.
const NumArray = ['one','two','three'];
NumArray.sort(() => 0.5 - Math.random());
Basically, how compare function works is when it take two positions from array and put them into the function if it returs positve value don't change the order and vice versa.
so here Math.random(); give between 0 to 1 and its subtracted from 0.5 .
We use sort() function, Inside sort we put a compare function which is have chances to return postive or negetive number 50/50 and thats how we are getting random sorted Array