Be Careful Where You Break Lines
Get to know the roles of semicolons and line breaks in JavaScript.
Introduction
A number of dynamically typed programming languages don’t care about semicolons and treat them as optional syntax. JavaScript is not one of them. Semicolons are not optional. In some places, a semicolon is critical, while in other places, it’s more of a stylistic choice. However, if you leave out a semicolon where it’s required, JavaScript does not complain. That’s because JavaScript follows the philosophy that it’s more fun to take revenge than to complain.
📝Note: Merely placing a
;
is not sufficient. We have to truly understand JavaScript’s automatic semicolon insertion (ASI) ...
Access this course and 1400+ top-rated courses and projects.