{"ScriptPreparationCode":"var length = 1e3\r\nvar arr = Array.from({length},(_,i) =\u003E ({id: i, rand: i * Math.random()}));\r\nvar target = Math.floor(length * Math.random());","TestCases":[{"Name":"findIndex","Code":"let outIdx1 = arr.findIndex((x) =\u003E x.id \u003E target \u0026\u0026 x.rand \u003E length/3 \u0026\u0026 Math.random() \u003E .5 );\r\n/*console.log(\u0027findIndex\u0027,outIdx1)*/","IsDeferred":false},{"Name":"for loop","Code":"let outIdx2 = -1\r\nfor (let i = 0; i \u003C arr.length; i\u002B\u002B) {\r\n if (arr[i].id \u003E target \u0026\u0026 arr[i].rand \u003E length/3 \u0026\u0026 Math.random() \u003E .5) {\r\n outIdx2 = i\r\n break\r\n }\r\n}\r\n/*console.log(\u0027for loop\u0027,outIdx2)*/","IsDeferred":false}]}