Promises

  • Promises are a way to keep track of an asynchronous operation
  • A "promise" that something will happen in the future
  • Promises can complete or fail (resolve or reject)
  • Promises allow callbacks to be set up for when a promise completes or fails
const myPromise = fetch("https://some-url.com");

myPromise
    .then(response => { return response.json() })
    .then(response => { console.log(response) })

2 / 23