Semicolons are an essential part of JavaScript code. They are read and used by the compiler to distinguish between separate statements so that statements do not leak into other parts of the code.
What does a semicolon mean in JavaScript?
The semicolon in JavaScript is used to separate statements, but it can be omitted if the statement is followed by a line break (or there's only one statement in a { block } ). A statement is a piece of code that tells the computer to do something.
Do semicolons do anything in JavaScript?
JavaScript semicolons are optional. ... This is all possible because JavaScript does not strictly require semicolons. When there is a place where a semicolon was needed, it adds it behind the scenes. The process that does this is called Automatic Semicolon Insertion.