Questions about optional semicolons in the authoritative guide to js

original

JavaScript does not fill in semicolons at all line breaks: JavaScript fills in semicolons only if the code cannot be parsed correctly without a semicolon.

demo

var b = 1
var foo = 2
var a = b + foo
(123)
// foo is not a function

but there is no filling in the semicolon. Why didn"t you add a semicolon to it? What"s wrong with my understanding?

Mar.01,2021

foo is an identifier. The browser parses to the next line with parentheses, which is considered to be a function call, and then your foo is not a function

.
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b2e8bc-2b46e.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b2e8bc-2b46e.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?