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 trialPiotr Połaniecki
Courses Plus Student 3,181 PointsWhat am I doing wrong?
In a quiz I had to finish a code:
function getRandom( upper ) { return Math.floor(Math.random() * upper) + 1; } ;
to call the function and pass an argument (12) to it. So I did it in this way:
getRandom (12);
It's wrong. Why? Please light me up...
5 Answers
Bogdan Cabaj
16,349 PointsYou have a space between getRandom and (12) . Should be getRandom(12) ???
Bogdan Cabaj
16,349 PointsYou are including a semicolon in the text box where a semicolon is already included at the end. The only thing you need is getRandom(12).
Piotr Połaniecki
Courses Plus Student 3,181 PointsThanks,
I already erased "my" semicolon and it still does not work...
Jason Anello
Courses Plus Student 94,610 PointsYeah, it looks like the quiz is not allowing a space there but it would be fine on a real project.
Piotr Połaniecki
Courses Plus Student 3,181 PointsHi Bogdan, please rewrite your comment as an answer so I can give you "best answer". Cheers.
Piotr Połaniecki
Courses Plus Student 3,181 PointsThanks guys,
You're right although it's strange because in previous videos Dave have used spaces. I compared my work with his work in Workspaces and everything was fine. Never mind, I passed the quiz anyway, I was just curious. Wish you all the best. Piotr
Abdi Nur
3,802 Pointsjust completed this quiz, seems getRandom(12); worked for me.
all the best.
Jason Anello
Courses Plus Student 94,610 PointsJason Anello
Courses Plus Student 94,610 Pointschanged from comment to answer
Piotr Połaniecki ,
I selected "best answer" for you.