javascript-tutorial / javascript-tutorial/en.javascript.info

{}.toString() now throws SyntaxError in browser, what happened?

Open
#3,323 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
HTML
Stars
25.5k
Forks
4k
PR merge metrics
No merged PRs in 30d

Description

Regarding 1-js/09-classes/06-instanceof, now Edge/Chrome browsers don't like this syntax anymore, and throws Uncaught SyntaxError: Unexpected token '.'

Now we have to write ({}).toString(). In Node.js {}.toString() still works. Was there a change in the spec recently or it's actually a bug in brower?

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with 1-js/09-classes/06-instanceof/article.md and reproduce the reported expression in Edge, Chrome, and Node.js. Check whether the article’s example needs clarification about parsing at the start of a statement, and document the browser behavior and the correct form if the issue is confirmed.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
documentation
Issue type
Documentation
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.