Write the example of the promise
Sigiloso
let myPromise = new Promise((resolve, reject) => { let success = true; if (success) { resolve("Operation was successful!"); } else { reject("Operation failed."); } }); myPromise .then(result => { console.log(result); // If resolved, this will be printed }) .catch(error => { console.log(error); // If rejected, this will be printed });