Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function runWithDebugger(callback, array){
- debugger;
- // when has second argument
- if(arguments.length > 1){
- // when second argument's type is array
- if(Array.isArray(array)){
- callback.apply(null, array);
- // when second argument's type is not array
- } else {
- try {
- throw new TypeError('The second argument must be an array.');
- } catch(e) {
- console.error(e.stack);
- }
- }
- // when no second argument
- } else {
- callback();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement