Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
const data = [ { Data: 2019, IdJudet: "09,18" },
{ Data: 2019, IdJudet: "09,18, 20, 03" },
{ Data: 2019, IdJudet: "09" },
{ Data: 2019, IdJudet: null }
]
//filterz pt a elimina judetul null si unesc dupa IdJudet plus normalizez spatiile
const county = data.filter(j => j.IdJudet != null).map(j => j.IdJudet).join(',').replace(/\s+/g, '')
//creez un array cu un set care nu permite valori duplicate
const noDuplicatesCounties = Array.from(new Set(county.split(',')))
console.log(noDuplicatesCounties)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.