{"ScriptPreparationCode":"const shuffleArray = array =\u003E {\r\n const arr = [...array];\r\n for (let i = arr.length - 1; i \u003E 0; i--) {\r\n const j = Math.floor(Math.random() * (i \u002B 1));\r\n const temp = arr[i];\r\n arr[i] = arr[j];\r\n arr[j] = temp;\r\n }\r\n return arr;\r\n}\r\n\r\nvar testArr = Array.from({\r\n length: 5000\r\n}, () =\u003E Math.floor(Math.random() * 4000));\r\nvar scrambled = shuffleArray(testArr);","TestCases":[{"Name":"sort manual idx","Code":"scrambled.sort((a,b) =\u003E {\r\n let idx1, idx2;\r\n for (let i = 0; i \u003C testArr.length;i\u002B\u002B) {\r\n \tif (testArr[i] === a) {\r\n idx1 = i\r\n if (idx2 != null) break\r\n } else if (testArr[i] === b) {\r\n idx2 = i\r\n if (idx1 != null) break\r\n }\r\n }\r\n return idx1 - idx2\r\n});","IsDeferred":false},{"Name":"sort findindex","Code":"scrambled.sort((a,b) =\u003E testArr.findIndex(t =\u003E t === a) - testArr.findIndex(t =\u003E t === b));","IsDeferred":false},{"Name":"map find","Code":"testArr.map((t) =\u003E scrambled.find(s =\u003E s === t));","IsDeferred":false}]}