JavaScript Treehouse Club - MASH MASH - JavaScript The Structure of Functions - Part 2 of 3

Maurice Yong
Maurice Yong
9,187 Points

Semi-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.

Tim Strand
Tim Strand
22,345 Points

No semi colon after a closing } however one just inside it might be required to indicate the end of that sentence.

2 Answers

Susanne Wagner
Susanne Wagner
16,579 Points

There 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
Maurice Yong
9,187 Points

Appreciate the quick responses guys! Should've done some quick reading before I posted the question ... getting my knowledge from other languages mixed up :)