Advertisement
Guest User

Untitled

a guest
Aug 23rd, 2019
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.44 KB | None | 0 0
  1. fetch(URL)
  2. // Call to the fetch function to grab data from the given API
  3. // This returns a promise
  4. .then(response => response.json( ))
  5. // Once the promise is fulfilled, it returns a response object which exposes a json method.
  6.  
  7. .then(function(resp))
  8. // This json method returns yet another promise which can then be chained on to another
  9. // .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