I have an array here and I have duplicated objects(?) whatever, and i want to console log only one of them based on nick instead both of them. How do I do that?
Snippet:
var _hero = [{
nick: "Mike",
lvl: 500,
x: 10,
y: 10
}, {
nick: "Mike",
lvl: 500,
x: 10,
y: 10
}]
let main = () => {
_hero.forEach(function(_hero) {
if (_hero.nick == "Mike") {
console.log(_hero);
}
});
};
main();