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 trialdariuszgrzywacz
10,770 PointsWhy does the initial code actually runs?
In the first part of the video, there is a code written without ";" character. Isn't it that there should always be one, even in a one-line program code?
3 Answers
mkmk
15,897 PointsJavascript is very lenient in its browser interpretation and most statements will have an assumed semi-colon, using Javascript's automatic semi-colon insertion (read more here: http://lucumr.pocoo.org/2011/2/6/automatic-semicolon-insertion/ ).
Best practice is to use the semi-colons.
dariuszgrzywacz
10,770 PointsOkay. I was just curious, i previously programmed in C++ and when i forgot to put a semi-colon to the code, program compilation was stopped. Thanks for the fast reply @mkmk :)
Nejc Vukovic
Full Stack JavaScript Techdegree Graduate 51,574 PointsWhen you start working with Grunt for example you will be reminded to put a semicolon:)