Skip to content

Instantly share code, notes, and snippets.

@arthyn
Last active September 25, 2017 03:40
Show Gist options
  • Save arthyn/22ec871a62a05d5acdfdeb2f430f1580 to your computer and use it in GitHub Desktop.
Save arthyn/22ec871a62a05d5acdfdeb2f430f1580 to your computer and use it in GitHub Desktop.
/**
* Function: runWithDebugger
* Runs callback with debugger initiated
*
* Params:
* callback - the function you want to debug
* args - the array of arguments being passed to the callback
* Return:
* result of callback
*/
function runWithDebugger(callback, args) {
debugger;
return callback.apply(this, args);
}
//Simple test:
function sayFullName(first, last) {
console.log(first + ' ' + last);
}
runWithDebugger(sayFullName, ['gordon', 'zhu']);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment