function iam_promise(key) { return new Promise((resolve, reject) => { if (key === "iam_boolean") { resolve("resolved"); } else { reject("rejected"); } });} iam_promise("iam_boolean") .then((data) => console.log(data)) .catch((err) => console.log(err));//Prints: resolved iam_promise("Hello") .then((data) => console.log(data)) .catch((err) => console.log(err));//Prints: rejected