Callbacks ?

What is Callbacks : You pass a function reference as a parameter to another function so that it can be executed at a later time

function f1(a){
}
function f2(b){
  var a=10;
   b(a);
}
f2 (f1);

Here i am passing f1 as a reference to f2. Then f2 is executing f1 inside its body.So f1 is the callback here because f2 has given some value to f1 as parameter which was f2’s local variable.

About

My Name is Dileep Singh, Noder, Javascript Lover & NoSql Developer, Fitness Freak, Love to travel new places, learning photography & Music Manic ♯ ♩ ♬

Posted in Javascript, Node.Js Tagged with: ,