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


2 Answers

Igor Yamshchykov
Igor Yamshchykov
24,395 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 :)