Some things take time: network requests, timers, files. Promises handle the waiting.
Direct answer
A promise is an object that represents a result that will arrive later. It starts as pending and becomes either fulfilled with a value or rejected with an error. Use .then() for success, .catch() for failure and Promise.all() to wait for several at once.
Example
fetch("https://api.example.com/users")
.then(response => response.json())
.then(data => console.log(data))
.catch(error => console.error("Failed:", error));
Creating a promise
const wait = (ms) => new Promise(resolve => setTimeout(resolve, ms));
wait(1000).then(() => console.log("One second later"));
Waiting for many
Promise.all([fetch(urlA), fetch(urlB)]).then(([a, b]) => {
console.log("Both done");
});
Where Teyro fits
Teyro's JavaScript for Beginners course turns this into short lessons you can play in a few minutes a day. It has 50 lessons, and you can start free.
The bottom line
Promises are the foundation of asynchronous JavaScript. Next, learn async and await.



