let arr = [1,2,3,4,5] arr.sort(() => { return 0.5 - Math.random() }) console.log(arr) // [4,2,1,3,5]