Reputation: 37018
I just discovered the debugger
keyword or whatever it is for JavaScript development, and I'm not clear what it is. Certainly it's not an expression, it has no value. But do I need to put a semi-colon after it? What is it defined as part of? I mean, it's technically like an addition to the language in the chrome runtime, isn't it?
(I know what it does, I just don't know the details of its implementation and how I would explain its lexical nature to someone else.)
Upvotes: 3
Views: 82
Reputation: 106375
It's actually described in ES5 standard - and yes, it's a statement
:
Syntax
DebuggerStatement :
debugger;
Semantics
Evaluating the
DebuggerStatement
production may allow an implementation to cause a breakpoint when run under a debugger. If a debugger is not present or active this statement has no observable effect.It is evaluated as follows:
- If an implementation defined debugging facility is available and enabled, then
- Perform an implementation defined debugging action.
- Let result be an implementation defined Completion value.
- Else
- Let result be (
normal, empty, empty
). Return result.
As a sidenote, most modern browsers - not only Chrome - support this functionality.
Upvotes: 6