js实现数组的随机排序 利用sort方法 let arr = [1, 12, 45, 34, 5, 6]; const randomSort = () => { return Math.random() > 0.5 ? -1 : 1; }; arr.sort(() => randomSort()); console.log("arr"