function shuffle(arr){ arr.sort((a,b) => a - b); for(let i = 1; i < arr.length - 1; i += 2){ const temp = arr[i]; arr[i] = arr[i + 1]; arr[i + 1] = temp; } return arr; }