{"ScriptPreparationCode":"const CHARS = \u0027abcdefghijklmnopqrstuvwxyz\u0027;\r\nconst RANDOM_KEY_LENGTH = 6;\r\nconst SAMPLE_SIZE = 200;\r\n\r\nfunction getRandChar() {\r\n return CHARS.at(Math.floor(Math.random() * CHARS.length));\r\n}\r\n\r\nvar items = Array.from({\r\n length: SAMPLE_SIZE\r\n}, (_, index) =\u003E \u0060${index}${Array.from({ length: RANDOM_KEY_LENGTH }, getRandChar).join(\u0027\u0027)}\u0060);","TestCases":[{"Name":"Reduce (creating temporary objects)","Code":"const result = items.reduce((acc, [item]) =\u003E ({\r\n ...acc,\r\n [item]: 1\r\n}), {});\r\nreturn result;","IsDeferred":false},{"Name":"Reduce (reuse object)","Code":"const result = items.reduce((acc, item) =\u003E {\r\n acc[item] = 1;\r\n return acc;\r\n}, {});\r\nreturn result;","IsDeferred":false},{"Name":"Object.fromEntries","Code":"const result = Object.fromEntries(items.map((item) =\u003E [item, 1]));\r\nreturn result;","IsDeferred":false},{"Name":"Plain","Code":"const result = {};\r\nitems.forEach((item) =\u003E {\r\n result[item] = 1;\r\n});\r\nreturn result;","IsDeferred":false}]}