Rules and Exceptions of Automatic Semicolon Insertion in JavaScript — In many programming languages, using a semicolon for terminating a statement is a must, however, in JavaScript, it is optional. You can omit the semicolon if the statements are written in separate lines. In this case, JavaScript adds the semicolon implicitly. …