DEV Community

loading...
Cover image for Use ";" or not in Javascript

Use ";" or not in Javascript

Jarvis-3000
Hi, I am a software Engineering Student and know web-developing and passionate to learn interesting skills.
・1 min read

Almost all programming languages have a concept of semicolon, but in javascript, it is in different manner.

We think that ";" is optional in JS, but it is not like that.

If we don't put ";" at the end of the statement, the ASI concept of JS will automatically insert ";" but not places in source code.

BUT,
In JS at certain places, it is mandatory to put semicolons manually otherwise the program will go wrong.



Semicolons and "Automatic Semicolon Insertion" are two of the most misunderstood topics in JavaScript.

For more deeply knowledge go to below link

https://medium.com/javascript-in-plain-english/automatic-semicolon-insertion-asi-in-javascript-made-simple-19c48d179494

Discussion (1)

Collapse
psiho profile image
Mirko Vukušić • Edited

Hate them, happy to be able to remove them, living without them with no issues whatsoever... Not nearly an issue as big as Medium articles behind login and\or paywall. That's the reason Im here.