// ? created a function that returns a promise, take a parameter of a boolean
function myPromise(bool) {
return new Promise((resolve, reject) => {
if (bool) {
resolve("I have succeeded");
} else {
reject("I have failed");
}
});
}
// ? call the function and pass in a boolean
myPromise(true).then((res) => console.log(res));
myPromise(false).then((res) => console.log(res)).catch((err) => console.log(err));