Skip to content

Instantly share code, notes, and snippets.

View gudleik's full-sized avatar
🏠
Working from home

Gudleik Rasch gudleik

🏠
Working from home
  • Drifti
  • Oslo
View GitHub Profile
@nolanlawson
nolanlawson / protips.js
Last active November 19, 2024 02:40
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!");