{"ScriptPreparationCode":null,"TestCases":[{"Name":"Map","Code":"\r\nconst arr = [\r\n {badge_id: \u00221\u0022}, \r\n {badge_id: \u00221\u0022}, \r\n {badge_id: \u00222\u0022}, \r\n {badge_id: \u00222\u0022}, \r\n {badge_id: \u00223\u0022}, \r\n {badge_id: \u00223\u0022}, \r\n {badge_id: \u00223\u0022}, \r\n {badge_id: \u00223\u0022}, \r\n {badge_id: \u00223\u0022}\r\n];\r\nconst distinctBadges = [];\r\narr.map((item) =\u003E {\r\n\t if (distinctBadges.filter((badgeRecord) =\u003E badgeRecord.badge_id == item.badge_id).length === 0) {\r\n distinctBadges.push(item);\r\n }\r\n});\r\nconsole.log(distinctBadges);","IsDeferred":false},{"Name":"Lodash","Code":"\r\nconst arr = [\r\n {badge_id: \u00221\u0022}, \r\n {badge_id: \u00221\u0022}, \r\n {badge_id: \u00222\u0022}, \r\n {badge_id: \u00222\u0022}, \r\n {badge_id: \u00223\u0022}, \r\n {badge_id: \u00223\u0022}, \r\n {badge_id: \u00223\u0022}, \r\n {badge_id: \u00223\u0022}, \r\n {badge_id: \u00223\u0022}\r\n];\r\nconst distinctBadges = _.uniq(arr);\r\nconsole.log(distinctBadges);","IsDeferred":false}]}