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

Bakari Lewis
Bakari Lewis
6,556 Points

Not sure why I am not passing. Am I passing the '12' the wrong way? im confused

n/a

2 Answers

Igor Yamshchykov
Igor Yamshchykov
24,397 Points

could you please provide your code sample?

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;

}

____________;

The answer is 'getRandom(12)'. I am unsure if you are passing getRandom('12') but this would be a number adding the single quote would make it a string and not a number and cause you to fail.

Please remember to mark your best answer :)