Create a new Promise object.
Source Code
let myPromise = new Promise((resolve, reject) => {
// Do something asynchronous which could succeed or fail
let success = true; // Hypothetical condition
if (success) {
resolve('Operation successful');
} else {
reject('Operation failed');
}
});