Skip to content

Instantly share code, notes, and snippets.

@razzius
Created April 13, 2020 18:26
Show Gist options
  • Save razzius/a5f865ac92e1798d3490fae54a429349 to your computer and use it in GitHub Desktop.
Save razzius/a5f865ac92e1798d3490fae54a429349 to your computer and use it in GitHub Desktop.
function toTest(a, b) {
return a + b
}
function debug(fn) {
return function() {
console.log(`Going to call ${fn.name} with ${[].slice.call(arguments).join(', ')}`)
result = fn.apply(this, arguments)
console.log(`Got result from ${fn.name} of`, result);
return result
}
}
debug(toTest)(1,2)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment