Skip to content

Instantly share code, notes, and snippets.

@oleg-webdev
Last active October 22, 2017 16:04
Show Gist options
  • Select an option

  • Save oleg-webdev/2f665e425d89155e08b797de0ca6a330 to your computer and use it in GitHub Desktop.

Select an option

Save oleg-webdev/2f665e425d89155e08b797de0ca6a330 to your computer and use it in GitHub Desktop.
async await simple example
const fetchPosts = async () => {
const res = await fetch("https://jsonplaceholder.typicode.com/posts/")
const json = await res.json()
return json
}
console.log(await fetchPosts())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment