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 trialMaurice Yong
9,187 PointsSemi-colon after Javascript function should go after closing curly-bracket?
Not sure if I'm wrong, but at the following challenge: https://teamtreehouse.com/library/treehouse-club-mash/mash-javascript/the-structure-of-functions-part-2-of-3
The semi-colon should go on the end of the closing curly-bracket character of the function shouldn't it? Currently it accepts the answer as a semi-colon on the normal bracket before the closing curly-bracket.
2 Answers
Susanne Wagner
16,579 PointsThere is never a semi-colon after a curly-bracket in Javascript.
The right answer to the linked challenge is:
function random_age(age) { Math.floor(Math.random() * age); }
Maurice Yong
9,187 PointsAppreciate the quick responses guys! Should've done some quick reading before I posted the question ... getting my knowledge from other languages mixed up :)
Tim Strand
22,458 PointsTim Strand
22,458 PointsNo semi colon after a closing } however one just inside it might be required to indicate the end of that sentence.