A collections of unique values
const set = new Set(['1', '2', '3', '4', '4']); for (let item of set) { console.log(`${ item }`); } set.add('5') set.size set.has('4') set.delete('4') set.clear(); set.forEach(x => console.log(x))
It is also possible to use an object as dictionary, with a small helper function
let dictionary = Object.fromEntries(data.map(x => [x.id, x.country])); console.log(dictionary["NL"])
329800cookie-checkJavascript Set object, Hashset, Dictionary (Typescript)