0

I don't like debugger. It's a risky piece of code to be adding into an application.

If this is accidentally left in the application prior to a live deployment, then the script will pause when developer tools are open.

Is there a cross-browser way of preventing debugger from pausing the code?

Then this could be configured so that debugger only pauses when the application is in development mode.

Curtis
  • 101,612
  • 66
  • 270
  • 352
  • You shouldn't keep `debugger` in the files after development imo. I would recommend using JSHint. Have a dev configuration that allows `debugger` and a prod configuration that doesn't. – Andy Jun 18 '14 at 09:47
  • @Andy I 100% agree, but human error is unavoidable. Thanks I'll look into JSHint as this is not currently part of the deployment process. However I'm still after a fail-safe which prevents `debugger` in a live environment, if it does manage to slip through the cracks. – Curtis Jun 18 '14 at 09:50
  • If you use git you could introduce a pre-commit process that does a grep on your JS files to look for "debugger" and doesn't allow a file to be pushed to the repo if it's found. – Andy Jun 18 '14 at 09:59

0 Answers0