Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

JavaScript JavaScript Basics (Retired) Introducing JavaScript The Console Challenge

question

do all javascript syntaxes end by a semicoln?

3 Answers

andren
andren
28,558 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.

stjarnan
seal-mask
.a{fill-rule:evenodd;}techdegree seal-36
stjarnan
Front End Web Development Techdegree Graduate 56,488 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 :)

Jonas

thank you!