Skip to content
Snippets Groups Projects

Initial commit: promise implementation added

Merged Harshith Karkera requested to merge main into master
2 files
+ 27
0
Compare changes
  • Side-by-side
  • Inline

Files

index.js 0 → 100644
+ 15
0
// 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);
});
Loading