JS Built-ins
Promisebeginner

Promise β€” typeof Promise function

πŸ“– 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.

typeof Promise

typeof Promise is 'function' because Promise is a constructor.

Challenge: Verify the type of Promise itself.

πŸ’‘ Hints (1)
  • β€’ Constructors are functions in JavaScript.