Breakpoint in JS Code
A quick way to force a browser to hit a breakpoint in a block of JS code is with the debugger keyword.
//codecodecode
debugger;
someMethodToDebug();
//morecodecodecode
When the browser is running the JS code it will automatically cause a breakpoint to occur in the code. Neat eh?
Written by Jonathan Creamer
Related protips
2 Responses
Just don't forget to remove it before committing :)
over 1 year ago
·
haha, good point!
over 1 year ago
·
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Debugging
Authors
Did you know?
JavaScript on a page runs with the privileges of that origin. One altered library, tag manager, or snippet can read inputs, change what people see, and call your APIs as the user.
Security insights from Cside
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#