// Creating a Promise const myPromise = new Promise((resolve, reject) => { setTimeout(() => { resolve("Hello World"); }, 1000); // Simulating an async operation with setTimeout }); // Calling the Promise myPromise .then((message) => { console.log("Message:", message); // Display the message }) .catch((error) => { console.error("Error:", error); });