Created
July 24, 2014 16:17
-
-
Save RedWolves/4f5355f2492d4690f298 to your computer and use it in GitHub Desktop.
Function Abstractions
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 (). |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment