If I type
}{
in the console of Firefox or Chrome, the result is undefined, not a SyntaxError.
This construction return undefined (construction like }!{ return false). What is the reason for such behavior?
If I type
}{
in the console of Firefox or Chrome, the result is undefined, not a SyntaxError.
This construction return undefined (construction like }!{ return false). What is the reason for such behavior?
When you enter debugger; in the console, a break point shows up, which reveals the answer:
with ((window && window.console && window.console._commandLineAPI) || {}) {
debugger;
}
In Chrome's developer tools, the input is wrapped inside a with block, then literally evaluated. So, when you put in }{, the following is evaluated:
with ((window && window.console && window.console._commandLineAPI) || {}) {
}{
}
This is an empty with block, followed by an empty block.
Exercise to reader: Try }for(;;){