Promise
Represents the eventual completion or failure of an asynchronous operation.
Syntax
javascript
new Promise((resolve, reject) => { ... })Example
javascript
function delay(ms) {
return new Promise(resolve => setTimeout(resolve, ms));
}
await delay(1000); // wait 1 second