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 916144a commit 261467aCopy full SHA for 261467a
12_Asynchronous_Concepts/12.md
@@ -37,7 +37,19 @@ const functionTwo = () => {
37
38
```
39
40
-```
+#### Callback functions
41
+
42
+```js
43
+// Callback functions
44
45
+const fetchUser = (username, callback) => {
46
+ setTimeout(() => {
47
+ callback({ username });
48
+ }, 2000);
49
+};
50
51
+fetchUser("Shubham", (user) => {
52
+ console.log(`Hello, ${user.username}`); // Hello, Shubham
53
+});
54
55
12_Asynchronous_Concepts/script2.js
@@ -0,0 +1,12 @@
1
2
3
4
+ console.log("Fetching...");
5
6
7
8
9
10
11
+ console.log(`Hello, ${user.username}`);
12
0 commit comments