We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent f89638f commit 442b8d4Copy full SHA for 442b8d4
12_Asynchronous_Concepts/script2.js
@@ -26,7 +26,20 @@ const fetchPhotoDetails = (photo) => {
26
});
27
};
28
29
-fetchUser("Shubham")
30
- .then((user) => fetchUserPhotos(user.username))
31
- .then((photos) => fetchPhotoDetails(photos[0]))
32
- .then((details) => console.log(`Your photo details are ${details}`));
+// This was one way of calling the function
+// fetchUser("Shubham")
+// .then((user) => fetchUserPhotos(user.username))
+// .then((photos) => fetchPhotoDetails(photos[0]))
33
+// .then((details) => console.log(`Your photo details are ${details}`));
34
+
35
+// The second way is using Async ==> Await
36
37
+const displayData = async () => {
38
+ const user = await fetchUser("Shubham");
39
+ const photos = await fetchUserPhotos(user.username);
40
+ const details = await fetchPhotoDetails(photos[0]);
41
42
+ console.log(details);
43
+};
44
45
+displayData();
AltStyle によって変換されたページ (->オリジナル) / アドレス: モード: デフォルト 音声ブラウザ ルビ付き 配色反転 文字拡大 モバイル
0 commit comments