{"ScriptPreparationCode":null,"TestCases":[{"Name":"reduce \u002B findIndex","Code":"const movies = Array.from({ length: 50 }).map(() =\u003E ({\r\n characters: Array.from({ length: 50 }).map((_, i) =\u003E ({\r\n id: Math.floor(Math.random() * 100),\r\n })),\r\n}));\r\n\r\nconst mergedCharacters = movies.reduce(\r\n (characters, movie) =\u003E characters.concat(movie.characters),\r\n []\r\n);\r\nconst uniqueCharacters = mergedCharacters.filter(\r\n (character, index) =\u003E mergedCharacters.findIndex((mCharacter) =\u003E mCharacter.id === character.id) === index\r\n);","IsDeferred":false},{"Name":"Loops \u002B Object.keys","Code":"const movies = Array.from({ length: 50 }).map(() =\u003E ({\r\n characters: Array.from({ length: 50 }).map((_, i) =\u003E ({ id: Math.floor(Math.random() * 100) }))\r\n}))\r\n\r\nconst uniqueCharacters = {}\r\nfor (let i = 0; i \u003C movies.length; i\u002B\u002B) {\r\n for (let j = 0; j \u003C movies[i].characters.length; j\u002B\u002B) {\r\n uniqueCharacters[movies[i].characters[j].id] = movies[i].characters[j];\r\n }\r\n}\r\nconst characters = Object.values(uniqueCharacters);","IsDeferred":false}]}