var db = [
{Id: "201" , Player: "Nugent",Position: "Defenders"},
{Id: "202", Player: "Ryan",Position: "Forwards"},
{Id: "203" ,Player: "Sam",Position: "Forwards"},
{Id: "204", Player: "Bill",Position: "Midfielder"},
{Id: "205" ,Player: "Dave",Position: "Forwards"},
]
What's the best way to find the length of if you have duplicated value of the properties? Notice I have duplicated value as "Forwards" on second , third and last object I want to something like :
for (var key in db) {
var value = db[key];
if ( length of duplicated values == 3) {
console.log("we have three duplicated values)
}
}
Is it possible to do this while the objects are being looped? Please let me know. Thanks.
Aucun commentaire:
Enregistrer un commentaire