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 trial

JavaScript JavaScript Basics (Retired) Creating Reusable Code with Functions Review: Giving Information to Functions

Why getRandom(12); is incorrect?

Complete the code below to call the function and pass the value 12 to it: function getRandom( upper ) { return Math.floor(Math.random() * upper) + 1; }

//What's the answer? Isn't it getRandom(12); Treehouse says that's wrong.

6 Answers

Clayton Perszyk
MOD
Clayton Perszyk
Treehouse Moderator 48,723 Points

If you're adding a semi-colon to your answer, remove it. There's already one provided

that was it! My fault

M W
M W
3,446 Points

Frustrating when it isn't obvious that the semicolon was provided - not to my old eyes anyway. Waste time looking for alternate answers when the correct one was typed in originally. Would be useful if the program could highlight it when it is just something like this. :)

getRandom(12).

Steve Fan
Steve Fan
8,218 Points

Omg what kind of tricky, i was being stuck with this question for a while =.= Tks vwaner for posting this question before. It saves my time.