Skip to content

Instantly share code, notes, and snippets.

View jasonmevans's full-sized avatar
🌮

Jason Evans jasonmevans

🌮
  • San Francisco, CA
View GitHub Profile
@nolanlawson
nolanlawson / protips.js
Last active February 4, 2024 18:06
Promise protips - stuff I wish I had known when I started with Promises
// Promise.all is good for executing many promises at once
Promise.all([
promise1,
promise2
]);
// Promise.resolve is good for wrapping synchronous code
Promise.resolve().then(function () {
if (somethingIsNotRight()) {
throw new Error("I will be rejected asynchronously!");