Advertisement
Guest User

Untitled

a guest
Jun 17th, 2019
109
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. fetch("api.something.com/films")
  2.     .then(response => {
  3.         // response object
  4.         // calling JSON returns response body in JSON format, kinda like JSON.parse(body) but it handles reading the body until completion for you
  5.         return response.json();
  6.     }).then(films => {
  7.         // the paramter "films" can be called whatever you want, you're simply passing a function that takes in one param
  8.         // do whataver you want with the films
  9.         // its an array of objects
  10.     })
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement