JSFiddle - React, Tailwind, and code Playground
by dmelnik
JavaScript
var isSorted = false;
var arr = [1, 3, 2];
while (!isSorted) {
var newArr = _.shuffle(arr);
isSorted = _.every(newArr, function(item, index, sortedArr) {
debugger;
return index > 0 && sortedArr[index] > sortedArr[index - 1];
});
if (isSorted) { console.log(newArr); }
}