Last active
September 26, 2018 12:02
-
-
Save nick-wireless/41405eea8a4987ccaba0b6d72878fca8 to your computer and use it in GitHub Desktop.
Improving runWithDebugger
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 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