{"ScriptPreparationCode":"var a = Array(1000).fill(0).map(_ =\u003E ({ value: Math.floor(500 * Math.random())}));","TestCases":[{"Name":"Property","Code":"function find(x, a, getValue) {\r\n let min = 0;\r\n let max = a.length - 1;\r\n while (min \u003C= max) {\r\n const guess = Math.floor((min \u002B max) / 2);\r\n const item = a[guess];\r\n const itemValue = getValue(item);\r\n if (x === itemValue) {\r\n return guess;\r\n } else if (x \u003C itemValue) {\r\n max = guess - 1;\r\n } else {\r\n min = guess \u002B 1;\r\n }\r\n }\r\n\r\n return null;\r\n}\r\n\r\nfind (100, a);\r\n","IsDeferred":false},{"Name":"Delegate","Code":"function find(x, a, getValue) {\r\n let min = 0;\r\n let max = a.length - 1;\r\n while (min \u003C= max) {\r\n const guess = Math.floor((min \u002B max) / 2);\r\n const item = a[guess];\r\n const itemValue = getValue(item);\r\n if (x === itemValue) {\r\n return guess;\r\n } else if (x \u003C itemValue) {\r\n max = guess - 1;\r\n } else {\r\n min = guess \u002B 1;\r\n }\r\n }\r\n\r\n return null;\r\n}\r\n\r\nfind (100, a, item =\u003E item.value);","IsDeferred":false}]}