JS Built-ins
Promisebeginner

Promise β€” instanceof

πŸ“– Usage Example
const p = new Promise((resolve, reject) => {
  setTimeout(() => resolve(42), 100)
})
p.then(v => console.log(v))  // β†’ 42

The Promise constructor takes an executor function with resolve and reject callbacks to create a new promise.

Promise Constructor

new Promise((res) => res(1)) instanceof Promise is true.

Challenge: Verify the instanceof check.

πŸ’‘ Hints (1)
  • β€’ All Promise instances pass the instanceof Promise check.