Thursday, September 10, 2020

Selecting distinct values from a JSON

 

eData is the JSON array

var items = eData.map((d)=> {return d.year})

var uniq = items.filter(GetUnique)


function GetUnique(value, index, self) { 
    return self.indexOf(value) === index;
}

No comments:

Post a Comment

Your feedback is always appreciated. I will try to reply to your queries as soon as time allows.Please don't spam,spam comments will be deleted upon reviews.