3

我在 chrome 上遇到了问题。 chrome有bug吗?

为什么会导致语法错误?我在nodejs中试过了,没问题。

4

1 回答 1

8

In the context in which you are running (and the Chrome and Node REPLs have different default contexts) it, the { character starts a block, not an object literal.

You can't follow a string with a : in a block.

If you were to say ({ "a": 1 }) you would change the context so it would be an object literal.

于 2013-07-30T09:41:50.043 回答