Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- fetch(URL)
- // Call to the fetch function to grab data from the given API
- // This returns a promise
- .then(response => response.json( ))
- // Once the promise is fulfilled, it returns a response object which exposes a json method.
- .then(function(resp))
- // This json method returns yet another promise which can then be chained on to another
- // .then(), which at that point can be logged to the console, or passed as an argument to another function.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement