{"ScriptPreparationCode":"var array1 = []\r\nvar array2 = []\r\nvar array = []\r\n\r\nfor (let i = 0; i \u003C 1000; i\u002B\u002B) {\r\n array1.push({\r\n hash: \u0060hash-1-${i}\u0060,\r\n value: \u0060value-1-${i}\u0060,\r\n })\r\n array2.push({\r\n hash: \u0060hash-2-${i}\u0060,\r\n value: \u0060value-2-${i}\u0060,\r\n })\r\n\r\n array.push({\r\n key: \u0060hash-1-${i}\u0060,\r\n hash: \u0060hash-1-${i}\u0060,\r\n value: undefined,\r\n })\r\n\r\n array.push({\r\n key: \u0060hash-2-${i}\u0060,\r\n hash: \u0060hash-2-${i}\u0060,\r\n value: undefined,\r\n })\r\n}","TestCases":[{"Name":"find","Code":"for (let i = 0; i \u003C array.length; i\u002B\u002B) {\r\n const found =\r\n array1.find(({ hash }) =\u003E hash === array[i].hash) ||\r\n array2.find(({ hash }) =\u003E hash === array[i].hash)\r\n array[i].value = found.value\r\n}","IsDeferred":false},{"Name":"from Entries","Code":"const mapArray1 = Object.fromEntries(\r\n array1.map(({ hash, value }) =\u003E [hash, value])\r\n)\r\nconst mapArray2 = Object.fromEntries(\r\n array2.map(({ hash, value }) =\u003E [hash, value])\r\n)\r\n\r\nfor (let i = 0; i \u003C array.length; i\u002B\u002B) {\r\n const found = mapArray1[array[i].hash] || mapArray2[array[i].hash]\r\n array[i].value = found\r\n}\r\n","IsDeferred":false},{"Name":"Reduce ","Code":"const mapArray1 =\r\n array1.reduce((result, { hash, value }) =\u003E ({...result, hash: value}), {})\r\n\r\nconst mapArray2 =\r\n array2.reduce((result, { hash, value }) =\u003E ({...result, hash: value}), {})\r\n \r\nfor (let i = 0; i \u003C array.length; i\u002B\u002B) {\r\n const found = mapArray1[array[i].hash] || mapArray2[array[i].hash]\r\n array[i].value = found\r\n}\r\n","IsDeferred":false}]}