JSFiddle - React, Tailwind, and code Playground
HTML
<div id="result"></div>
JavaScript
var arr = [ 3, 2, 8, 1, 5, 1 ];
var predicate = function(a, b) {
return Math.random() - 0.5;
};
document.getElementById("result").innerHTML = "[" + arr.sort(predicate) + "]";