How to check if 'debugger;' keyword exists?

javascript

Solution

You cannot.

The best solution would be adding a hook to your version control system to prevent code containing `debugger;` statements from being committed/pushed.

Asking your devs to search for `debugger;` or at least have a careful look at the diff before committing is also a solution - but not as effective as hard-rejecting in the VCS.

Problem

Sometimes some developers forgot to remove `debugger;` in javascript code, and it produce javascript error on IE. How can you check (like for the console: `if(window.console){console.log('foo');}`) if a debugger exists? BTW: I don't want to detect if the browser is IE, I want a generic method if possible Thanks,

Original source