Skip to content

Commit cee62fc

Browse files
committed
Update README.md
1 parent fd98920 commit cee62fc

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

README.md

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -904,25 +904,25 @@ Callback is called when task get completed and is asynchronous equivalent for a
904904
/**
905905
* Callback Function
906906
*/
907-
function myAsync(a, b, callback) {
908-
setTimeout(function () {
909-
callback(a + b);
910-
}, 0);
907+
function message(name, callback) {
908+
console.log("Hi" + " " + name);
909+
callback();
911910
}
912-
console.log("Before Asynchronous Call");
913911

914-
myAsync(10, 20, function (result) {
915-
console.log("Sum: " + result);
916-
});
917-
console.log("After Asynchronous Call");
912+
// Callback function
913+
function callMe() {
914+
console.log("I am callback function");
915+
}
916+
917+
// Passing function as an argument
918+
message("Node.JS", callMe);
918919
```
919920

920921
**Output:**
921922

922923
```js
923-
Before Asynchronous Call
924-
After Asynchronous Call
925-
Sum: 30
924+
Hi Node.JS
925+
I am callback function
926926
```
927927

928928
<div align="right">

0 commit comments

Comments
 (0)