Set is helpful if you want to return unique values from an array.
if you had an array of people's favorite pokemon, and you wanted to see how many unique Pokemon there were... numbers const pokePals = ["Lapras", "Wartortle", "Gyrados", "Dragonair", "Gyrados", "Kingdra", "Lapras", "Bulbasaur"];
If you wanted a list that showed all the Pokemon that had favorite votes without seeing duplicates,
const favs = [...new Set(pokePals)];
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Set is helpful if you want to return unique values from an array.
if you had an array of people's favorite pokemon, and you wanted to see how many unique Pokemon there were... numbers const pokePals = ["Lapras", "Wartortle", "Gyrados", "Dragonair", "Gyrados", "Kingdra", "Lapras", "Bulbasaur"];
If you wanted a list that showed all the Pokemon that had favorite votes without seeing duplicates,
const favs = [...new Set(pokePals)];