Thursday 10 January 2013

Call Back in node.js

-->
We can add call back in node.js in two ways
1.Write a call back inside a method
Ex:
fs.readFile('/abc/def',function(err,data) {
console.log(data);
});
2. Create a variable for call back and add call back to the function.
var callback=function(err,data){
console.log(data);
}
fs.readFile('/abc/def',callback);

0 comments:

Post a Comment