addition(2,function(addRes,err){ if(!err){ Subtract(addRes,function(subRes,err){ if(!err){ multiplication(subRes,function(mulRes,err){ console.log(mulRes); }); } }); } }); function addition(val,callback){ callback(val+5,false); } function Subtract(val,callback){ callback(val-3,false); } function multiplication(val,callback){ callback(val*5,false); } In the above code, there is three operation addition, Subtract and multiplication. Which is using a callback…
Expand +Tag: difference between callback and promise
Basic Difference Between Callback and Promise
Callback: A Callback is a function that we call inside another function. A callback may or may not performed asynchronously. Normally callback runs after the parent function completes its operation. function calculate(x) { return x+2; } function display(y) { //execute…
Expand +