Programming Concepts — Promise
A Promise represents a value that may be available now, later, or never. It is commonly used for handling asynchronous operations in JavaScript.
let promise = new Promise((resolve, reject) => {
let success = true;
if (success) resolve('Operation succeeded');
else reject('Operation failed');
});
promise.then(console.log).catch(console.error);