Skip to content

Instantly share code, notes, and snippets.

@amysimmons
Created June 11, 2018 14:01
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 amysimmons/0e30397b650307104f0d4917a8500fff to your computer and use it in GitHub Desktop.
Save amysimmons/0e30397b650307104f0d4917a8500fff to your computer and use it in GitHub Desktop.
// p1 and p2 are the same

const p1 = new Promise(function(resolve, reject) {
  reject('Oh no');
});

const p2 = Promise.reject('Oh no');

// p3 and p4 are the same

const p3 = new Promise(function(resolve, reject) {
  resolve(42);
}); 

const p4 = Promise.resolve(42);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment