How to set a JavaScript breakpoint from code in Chrome?

Paul picture Paul · Apr 7, 2012 · Viewed 273k times · Source

I want to force the Chrome debugger to break on a line via code, or else using some sort of comment tag such as something like console.break().

Answer

xn. picture xn. · Apr 7, 2012

You can use debugger; within your code. If the developer console is open, execution will break. It works in firebug as well.