Reputation:
From MDN.
Invokes any available debugging functionality. If no debugging functionality is available, this statement has no effect.
I've debugged in IE, Safari, and FF and have found no need for this keyword. Does it have a practical use? Can someone provide a practical example?
Upvotes: 1
Views: 110
Reputation: 132
Typing debugger; into your code triggers the same functionality as setting a breakpoint in the debugging utility. I have had various debugging utilities not show the script because of using a script inside a cms or other unknown reasons. However the scripts still halted and allowed me to check the state of variables where ever i used debugger;
This may be a stretch of a practical example but i have found a use for it.
Technically
debugger;
appears to be a manual or coding way to trigger a debug utility as opposed to setting a break point inside of a debug utility. Hope this helps.
Upvotes: 2