You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Jun 23, 2018. It is now read-only.
Using Firefox 12, Windows. Amjad said at the last NYC.js that this was a bug, so I finally am getting around to filing it.
Consider the following code:
"use strict";varx=Object.freeze({});x.foo="bar";
if I type it in the left pane, and press the array to send it rightward, I get an error, as expected:
TypeError: x.foo is not extensible
But if I reload the page and type it in line-by-line, over in the right pane, no error appears. But of course, typing in x subsequently gives => {}. That is, strict mode was never entered, and it reverted to the non-strict behavior of silently ignoring the property write instead of throwing noisily.
I would really love this feature in order to give live REPL demonstrations of certain ES5 features in a lightning talk. Things like Object.freeze and Object.defineProperty have much more obvious behavior (viz. throwing errors) when in strict mode. If JSRepl added the ability to keep your code in strict mode, it would be ahead of all the current browser consoles I've tested for such purposes.
One solution might be to have a JavaScript Strict Mode option on the web page, just like there's currently a JavaScript.next.
I'm open to submitting a pull request for this myself, if you want to give some implementation hints :)
The text was updated successfully, but these errors were encountered:
Using Firefox 12, Windows. Amjad said at the last NYC.js that this was a bug, so I finally am getting around to filing it.
Consider the following code:
if I type it in the left pane, and press the array to send it rightward, I get an error, as expected:
But if I reload the page and type it in line-by-line, over in the right pane, no error appears. But of course, typing in
x
subsequently gives=> {}
. That is, strict mode was never entered, and it reverted to the non-strict behavior of silently ignoring the property write instead of throwing noisily.Presumably the same problem is occurring here as is described in this article under "Why can’t I run global Strict Mode in my browser console?"
I would really love this feature in order to give live REPL demonstrations of certain ES5 features in a lightning talk. Things like
Object.freeze
andObject.defineProperty
have much more obvious behavior (viz. throwing errors) when in strict mode. If JSRepl added the ability to keep your code in strict mode, it would be ahead of all the current browser consoles I've tested for such purposes.One solution might be to have a JavaScript Strict Mode option on the web page, just like there's currently a JavaScript.next.
I'm open to submitting a pull request for this myself, if you want to give some implementation hints :)
The text was updated successfully, but these errors were encountered: