Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

JavaScript JavaScript Basics (Retired) Introducing JavaScript The Console Challenge

question

do all javascript syntaxes end by a semicoln?

3 Answers

andren
andren
28,504 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!