Skip to content

Instantly share code, notes, and snippets.

@gvergnaud
gvergnaud / Promises-under-the-hood.md
Last active August 27, 2024 00:29
Promises, under the hood.

Promises, under the hood

Everyone knows that to create a new Promise, you need to define it this way:

  new Promise((resolve, reject) => {
    ...
    resolve(someValue)
  })

You pass a callback that defines the specific behavior of your promise.