JavaScript-Random


#1

When I did console.log('Math.random()*100') I couldn’t get a random number and I also couldn’t get a result when I did with Math.floor. I have tried in different ways but I couldn’find it?
Thank you for your response.


#2

the apostrophes just make it a string. If you want to use the math random function, don’t make it a string


#3

ooh okay, but I did try without string too actually… So do I still have to write console.log? Or do I start directly Math.floor(Math.random()*100) ?


#4

if you want to log to the console, then yes. If logging isn’t needed, then no. In the exercise, very likely that you need it.


#5

Okay I understand, thank you!


#6

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