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 trialRobert Chamblee
12,711 PointsSemicolon Neglect.
I notice sometimes in these videos that a semicolon is not added at the end of a line and yet Chrome still executes it without giving an error. Is it just a Chrome thing to forgive that lack of semicolon or is it typical of all browsers? At what point would that become an issue and break your program?
2 Answers
notf0und
11,940 PointsI believe JavaScript has Automatic Semicolon Insertion (ASI for short) that acts on JS code. In JavaScript, there are certain things that require semi-colons, and certain things that don't. Here's a blog post that helps to fully understand what's going on: http://inimino.org/~inimino/blog/javascript_semicolons
Here's another: http://bclary.com/2004/11/07/#a-7.9.1
Aaron Graham
18,033 PointsThis lays it out pretty well: http://stackoverflow.com/questions/2846283/what-are-the-rules-for-javascripts-automatic-semicolon-insertion-asi In short, in certain places you can omit them and they will be automatically inserted when your code is interpreted.