JavaScript JavaScript Basics (Retired) Introducing JavaScript The Console Challenge


do all javascript syntaxes end by a semicoln?

3 Answers

28,492 Points

A semicolon can be used to mark the end of your statement, and it's pretty common to include it, but unlike a lot of other languages it's not actually mandatory to include it unless you are typing multiple statements on the same line.

.a{fill-rule:evenodd;}techdegree seal-36
Front End Web Development Techdegree Graduate 56,487 Points

I suppose I could have been more clear.

Like andren mentions, you don't have to use them, and as he said it's only required when you have multiple statements on the same line.

It is good practice to use them however, and makes your code easier to work with. A great example as to why you would like to use them is that if you at a point in the future decide to compress your code, your lines will not look like they do in your text editor and this could cause a lot of problems.

I hope that helps, if you have any further questions you're free to tag me :)


thank you!