Last active
February 25, 2017 17:26
-
-
Save Dosant/980a96aa791664d48c505a8d84d25964 to your computer and use it in GitHub Desktop.
JS Bin// source https://jsbin.com/kuneyiq
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
function callAndLog(a, b, operation) { | |
console.log('Will call operation with params: ' + a + ', ' + b); | |
return operation(a,b); | |
} | |
function add(a,b) { | |
return a+b; | |
} | |
add(2,2); // 2; | |
callAndLog(3,3,add); // 9 (And logs message in console) | |
callAndLog(3,3, function(a,b) { | |
return a-b; | |
}); // 0 (And logs message in console) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment