Skip to content
This repository has been archived by the owner on Sep 21, 2021. It is now read-only.

FF Nightly console: Empty object literal evaluates to undefined, object with quoted key gives syntax error #1083

Open
marianoguerra opened this issue Aug 24, 2018 · 2 comments

Comments

@marianoguerra
Copy link

I'm writing an introduction to js using Firefox devtools and the basic examples force me to explain more than I should.

I'm trying to introduce the JSON subset first, so no undefined and all object keys quoted, the problem is that an empty object literal evaluates to undefined, I assume it thinks it's an empty scope (Chrome evaluates to an empty object).

Also, I can't enter object literals with quoted keys (works on Chrome).

Screenshot:

ff-bug

Let me know if I should report this somewhere else.

@claim claim bot added the not-available label Aug 24, 2018
@juliandescottes
Copy link
Member

Thanks! This would probably be better in bugzilla (https://bugzilla.mozilla.org/enter_bug.cgi?product=DevTools), but we might already have a bug on file for this.

{} and {"key": 42} are blocks of code and not objects (not sure if that's what you meant by scope). You can wrap them in parenthesis to get the expected behavior.

A few years ago Chrome changed the behavior of their console to start automatically turning such blocks into objects. We should probably do the same, but I don't know if we already have a bug on file for this. @nchevobbe should know.

@nchevobbe
Copy link
Member

Yes, we do have Bug 972530 for this, where there is already some discussion .

x = {key: 42} should return the object as well.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants