I'm a beginner programer and I've a problem with iterate in an array. I want to iterate the same list over an index of it. That is, I want to iterate [j] over [i]. Let [j] finish running and increase [i] I want to iterate the same list over an index of it. That is, I want to iterate [j] over [i]. Let [j] finish going through and increase [i] and do the same thing again until there is nothing else to go through.
for (let i = 0; i < results.length; i++) {
for (let j = i+1; j < results.length; j++) {
if (results[i].Email == results[j].Email){
// delete the item or items from the array
}
}
}
The array in question is this and i want to check if emails are duplicated for delete:
results = [
{Id: 1, Name: "Some", Lastname: "One", Email: "someone@email.com"},
{Id: 2, Name: "Some", Lastname: "One", Email: "someone@email.com"},
{Id: 3, Name: "Some", Lastname: "One", Email: "someother@email.com"}
]