I'm stuck at Lesson 7 - (Libraries) Instruction 2


#1

Hi!
I would love your help with the issue I am having with the code below. I am doing something wrong but can’t figure out what. :slight_smile:

https://www.codecademy.com/courses/learn-javascript-introduction/lessons/introduction-to-javascript/exercises/libraries?action=lesson_resume&course_redirect=introduction-to-javascript

I am trying to figure out where to put the parentheses correctly. I believe that is what I am doing wrong but it might be something else.


console.log (Math.floor(Math.random()) * 100);


#2

The above will always be zero since you are flooring a float less than 1, which will then become 0. 0 times anything is zero.

Math.floor(Math.random() * 100)

Above we multiple the float by 100, and then floor it, giving us a possible range of 0…99.


#3

Thank you for your response, mtf! I am still confused cause when I type in: console.log Math.floor(Math.random() * 100); and run it, it stills comes up wrong. What am I missing? Thank you!


#4

Missing opening and closing parentheses on console.log().


#5

Thank you so much, mtf for all your help! :smiley:


#6

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.