My code is this:
message.labels.forEach(/…/) container.data.push(message);
It throws Uncaught SyntaxError: Unexpected identifier
When I add a semicolon after the forEach
function it doesn't throw it anymore. I only change the semicolon there, I checked it with my git.
Why does it do it? Feels like I'm missing some JS fundamentals here.
The semi-colon ends a statement .
If you leave it out, then your two statements are treated as a single one, it doesn't make any sense and the compiler throw an error.
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.