You must've seen a lot of JavaScript code with semicolons, and a lot without semicolons as well. And surprisingly, both work fine! While languages such as C, C++, Java, and so on are strict about the use of semicolons, and on the other hand languages such as Python are strict about not using semicolons (only indentations), there is no such fixed rule for JavaScript.
So let's see when is semicolon required in JavaScript.