Skip to content

Instantly share code, notes, and snippets.

@mishelashala
Created July 27, 2020 14:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mishelashala/91547ab1717c92a9a115f8a5469302b1 to your computer and use it in GitHub Desktop.
Save mishelashala/91547ab1717c92a9a115f8a5469302b1 to your computer and use it in GitHub Desktop.
// fulfilled promise
const promisedNumber = Promise.resolve(12)
promisedNumber.then(value => console.log('number:', value))
// rejected promise
const rejectedString = Promise.reject(new Error('could not produce string'))
rejectedString.catch(err => console.log('error:', err.message))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment