JavaScript

What is a Promise?

Medium
4
Added
An object representing eventual completion/error of async operation with then/catch methods.

Solution Code

JavaScript
new Promise((resolve) => setTimeout(resolve, 1000))
Explanation
Promises help avoid callback hell and enable better async flow control.

Guided Hints

What problem do promises solve?
How to chain async operations?