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 trialmarvelousperson206
9,199 PointsCompletely stumped by this question
I've watched the video twice but it just isn't happening for me.
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;
}
;
4 Answers
Markus Ylisiurunen
15,034 PointsHi Russel!
I think it just wants you to call the function with the value 12.
function getRandom( upper ) {
return Math.floor( Math.random() * upper ) + 1;
}
getRandom(12);
marvelousperson206
9,199 PointsThanks Marcus. The thing is I tried that answer!
Jacob Mishkin
23,118 Pointscan you post your code, so we can see what the issue is then. please?
Ross King
20,704 PointsFor anyone else who is using the code getRandom(12); Remove the semicolon from the end. There is already a semicolon provided in the question which is why the error is occurring. Pretty frustrating I wasted time on this question!
casthrademosthene
6,275 PointsWow really in the video I could of sworn he use a semicolon at the end. I've been stuck on this question for the past 4hrs re-watching videos trying to figure out where I went wrong. Thank you for tip
marvelousperson206
9,199 PointsOk I figured out I was typing it wrong... had getRandom (12); Wasn't meant to have a space after the function!
Simon New
4,300 PointsHa, unbelievable... I made exactly the same mistake and was so confused as to why it wasn't right! Thanks, this Q/A saved me from further frustrations.
Jacob Mishkin
23,118 PointsJacob Mishkin
23,118 PointsAll you need to do is replace parameter variable with the number 12 in the function. when you call the function.