JavaScript JavaScript Basics 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 46,123 Points

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

that was it! My fault

maximleguennec
maximleguennec
Full Stack JavaScript Techdegree Student 4,776 Points

i have the same question, i don't understand, i'm typing

getRandom (12);

and its wrong !

M W
M W
3,444 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.