开发者

What a strange error in JS formatting of a new object?

开发者 https://www.devze.com 2023-01-05 11:02 出处:网络
开发者_开发知识库My javascript code that produces a syntax error: var x = { a: 123 }; The same code without an error:

开发者_开发知识库My javascript code that produces a syntax error:

var x =
{
  a: 123
};

The same code without an error:

var x = {
  a: 123
};

What the heck?


Javascript adds implicit ";" at the end of lines sometimes, I suppose this is what happens, and results in

var x = ;
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号