J Any
J Any

Reputation: 5057

How to debug JavaScript code in IE F12 console?

I am using IE9. I really like F12 debug console. I can input JavaScript code to try out without creating a file and loading it by a server.

However, I cannot set a breakpoint on the piece of code in console. What should I do?

Upvotes: 0

Views: 848

Answers (1)

Andy Sterland
Andy Sterland

Reputation: 1936

You need to make sure debugging has been started (Script->Start Debugging) then you can use the debugger keyword which will cause the debugger to break.

var x = 0;
debugger;
x++;

Upvotes: 2

Related Questions