Intermediate JavaScript
Q86 / 100

What is Promise.withResolvers() (ES2024)?

Correct! Well done.

Incorrect.

The correct answer is B) A method returning { promise, resolve, reject } so the resolver functions can be used outside the Promise constructor

B

Correct Answer

A method returning { promise, resolve, reject } so the resolver functions can be used outside the Promise constructor

Explanation

const { promise, resolve, reject } = Promise.withResolvers() replaces the deferred pattern. Useful when resolve/reject must be called from different places.

Progress
86/100