Skip to content

Instantly share code, notes, and snippets.

@nick-wireless
Last active September 26, 2018 12:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nick-wireless/41405eea8a4987ccaba0b6d72878fca8 to your computer and use it in GitHub Desktop.
Save nick-wireless/41405eea8a4987ccaba0b6d72878fca8 to your computer and use it in GitHub Desktop.
Improving runWithDebugger
function runWithDebugger(callback, arg1) {
if (Array.isArray(arg1)) {
debugger;
return callback.apply(null, arg1);
} else {
debugger;
return callback(arg1);
}
};
function sayFullName(lastName, firstName, middleName) {
if (!middleName) {
return ('hi ' + firstName + ' ' + lastName);
} else {
return ('hi ' + firstName + ' ' + middleName + ' ' + lastName);
}
};
var args1 = ['zhu', 'gordon'];
runWithDebugger(sayFullName, args1)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment