Lesson 21 of 50

JavaScript Promises

Promises represent asynchronous operations that may complete in the future. They are a modern way to handle async code without deep nesting.

let promise = new Promise((resolve, reject) => {
  setTimeout(() => resolve("Done!"), 1000);
});

promise.then(result => console.log(result));
← Previous Next →