Skip to content

Instantly share code, notes, and snippets.

@tomtobac
Created September 29, 2016 19:54
Show Gist options
  • Save tomtobac/a02648e5a502bfc36b247dc55e12382f to your computer and use it in GitHub Desktop.
Save tomtobac/a02648e5a502bfc36b247dc55e12382f to your computer and use it in GitHub Desktop.
fetch(`https://restcountries.eu/rest/v1/all`)
.then((res) => {
return res.json()
})
.then((values) =>{
let array = values
.map(x => {return x.currencies[0];})
//.filter((v, i, a) => a.indexOf(v) === i); // filter unique
array = Array.from(new Set(array)) // filter ES6 way
console.log(array)
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment