You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: questions/explain-the-concept-of-a-callback-function-in-asynchronous-operations/en-US.mdx
+5-7Lines changed: 5 additions & 7 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -32,7 +32,7 @@ A callback function is a function that is passed as an argument to another funct
32
32
33
33
### Example of a synchronous callback
34
34
35
-
```js
35
+
```js live
36
36
functiongreet(name, callback) {
37
37
console.log('Hello '+ name);
38
38
callback();
@@ -76,13 +76,11 @@ fetchData((data) => {
76
76
77
77
When dealing with asynchronous operations, it's important to handle errors properly. A common pattern is to use the first argument of the callback function to pass an error object, if any.
0 commit comments