简体   繁体   中英

Error creating an empty object literal

Uncaught SyntaxError: Unexpected end of input is显示在 Chrome 控制台上,行号导致:

var A={};

I don't think there is anything wrong with that, try to check the code above it; maybe you're missing a bracket or a semicolon.

Im sure if you remove it, you will still get an error on another line.

This looks correct. Most probably, the line before the line:

var A = {};

Should have the issue. And if you try to remove this line, there will be error thrown in the same line again, but it would have a different code. Check for missing semi-colons in the previous line.

This error occurs when the JS file ends with an unresolved bracket or paren [0], and so the actual fix needs to be applied above the line you posted.

Run a syntax checker like JSHint against it to find the source of the error.

[0] https://stackoverflow.com/a/3594969/1216976

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM