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 trialRyan Jin
15,337 PointsDo you really need a semicolon in Javascript / jQuery?
Do you really need a semicolon after each statement? Or is it like Swift, which doesn't require a ";" after a statement
2 Answers
Chyno Deluxe
16,936 PointsJavascript has specific rules about when and where semi-colons are needed. For the most part, yes, it does require a semi-colon after each statement but there are times when doing so could stop the rest of your code from being read.
I'd suggest you complete the Full-Stack Javascript Course if you aren't doing so now, for a better understanding of these rules.
I hope this helps.
Stephen Layton
8,643 PointsThis is a matter of taste according to some. I myself use them for readability. A few places even 'require' using them, https://github.com/airbnb/javascript#semicolons.