We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 5688ab0 commit 277eb09Copy full SHA for 277eb09
1 file changed
part9_Advanced/promises.js
@@ -60,3 +60,19 @@ myPromise.then((data) => {
60
console.log(`error fetching data ${error}`);
61
})
62
console.log(myPromise);
63
+
64
65
+// Creating another promise
66
+const p = new Promise((resolve, reject) => {
67
+ setTimeout(() => {
68
+ resolve("Promise resolved");
69
+ }, 4000);
70
+})
71
72
+p.then(() => {
73
+ console.log('data fetched successfully');
74
+}).catch(() => {
75
+ console.log("Error fetching data");
76
+}).finally(() => {
77
+ console.log("Program completed");
78
0 commit comments