{"ScriptPreparationCode":"/* make a new array with 15k items */\r\nvar arr = new Array(15000);\r\n\r\n/* fill array tems with basic object */\r\narr.fill({ id: 0 });\r\n\r\n/* generate 2 random numbers in our 15k range */\r\nvar foo = Math.floor(Math.random() * 15000);\r\nvar bar = Math.floor(Math.random() * 15000);\r\n\r\n/* set the index of arr[foo] to foo for our tests */\r\narr[foo].id = foo;","TestCases":[{"Name":"find","Code":"/* make a new array with 15k items */\r\nvar arr = new Array(15000);\r\n\r\n/* fill array tems with basic object */\r\narr.fill({ id: 0 });\r\n\r\n/* generate 2 random numbers in our 15k range */\r\nvar foo = Math.floor(Math.random() * 15000);\r\nvar bar = Math.floor(Math.random() * 15000);\r\n\r\n/* set the index of arr[foo] to foo for our tests */\r\narr[foo].id = foo;","IsDeferred":false},{"Name":"loop","Code":"const bookFreePlatform = (arr, foo, bar) =\u003E {\r\n\r\n /* find array item where id == foo */\r\n for (let i = 0; i \u003C arr.length; i\u002B\u002B) {\r\n\r\n /* not an error check, just a simple comparison */\r\n if (arr[i].id === foo) {\r\n\r\n /* if we got here, it found and index, lets edit it and log it again */\r\n arr[i].id = bar;\r\n console.log(arr[i]);\r\n\r\n /* stop the loop to save time and resources, we\u0027re done */\r\n break;\r\n }\r\n }\r\n\r\n /* return altered array */\r\n return arr;\r\n}\r\n\r\nbookFreePlatform(arr, foo, bar);","IsDeferred":false},{"Name":"loop without lenght inside","Code":"const bookFreePlatform = (arr, foo, bar) =\u003E {\r\n\tlet outside = arr.length;\r\n /* find array item where id == foo */\r\n for (let i = 0; i \u003C outside ; i\u002B\u002B) {\r\n\r\n /* not an error check, just a simple comparison */\r\n if (arr[i].id === foo) {\r\n\r\n /* if we got here, it found and index, lets edit it and log it again */\r\n arr[i].id = bar;\r\n console.log(arr[i]);\r\n\r\n /* stop the loop to save time and resources, we\u0027re done */\r\n break;\r\n }\r\n }\r\n\r\n /* return altered array */\r\n return arr;\r\n}\r\n\r\nbookFreePlatform(arr, foo, bar);","IsDeferred":false}]}