Qasim
Qasim

Reputation: 1580

Can I console.debug() and make Chrome Dev-tools breakpoint there?

Can I manually set breakpoints from my code(like by writing console.debug at that point).

Debugging problems with cache, it's important to breakpoint there the first time I load it. If I have to add a breakpoint then reload, I can't test caching(problems with functions not defined on first-load, but working subsequently).

Upvotes: 0

Views: 124

Answers (2)

Jagdish Idhate
Jagdish Idhate

Reputation: 7742

You can override console.debug and set debugger there, so we can change it to below

var debugCopy = console.debug.bind(console)
console.debug = function(){
  debugger;
  return debugCopy.apply(console,arguments)
}

Upvotes: 0

Bennett Adams
Bennett Adams

Reputation: 1818

See google documentation. Just write debugger in your code, and Chrome will pause execution there.

Manual breakpoints are individual breakpoints that you set on a specific line of code. You can set these via the Chrome DevTools GUI, or by inserting the debugger keyword in your code.

Upvotes: 3

Related Questions