RedWolves
7/24/2014 - 4:17 PM

Function Abstractions

Function Abstractions

var work = function () {
  console.log("working hard!");
};

var doWork = function(f) {
  
  console.log("starting");
  
  try {
    f();
  } catch (ex) {
    console.log(ex);
  }
  
  console.log("end");
};

doWork(work);  // we only pass the reference to work we don't invoke it with ().