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

Mark Reitz
Mark Reitz
692 Points

what did I do wrong here?

What did I do wrong with the bottom line to call the function?

function getRandom( upper ) { return Math.floor(Math.random() * upper) + 1; } console.log(getRandom(12));

Adam Beer
Adam Beer
11,314 Points

Code

Wrap your code with 3 backticks (```) on the line before and after. If you specify the language after the first set of backticks, that'll help us with syntax highlighting.

      ```html
      <p>This is code!</p>
      ```

3 Answers

Steven Parker
Steven Parker
231,275 Points

The instructions ask you to "call the function and pass the value 12 to it", but they don't say anything about using "console.log" and don't expect to see it in the answer.

Hi! I put this code

'{ getRandom(12)}'

which apparently doesn't work. Can you advise?

Thanks!

Steven Parker
Steven Parker
231,275 Points

I'm guessing you don't actually type in those single quotes, that would make the entire thing a literal string.

But you also don't need the braces. In actual code, they wouldn't be a problem but the quiz isn't expecting the answer to have them.

And in future, start a fresh question instead of asking one as an "answer" to an old question. That way more students will see your question and get a chance to respond.