Hey can I have help with a simple code.. T^T?


#1

I have been having a little trouble with math.random. I didn’t get it. Of course I could have skipped it or just made it do it for me but It didn’t tell me what I did wrong and RNG is a big part of coding! I really need some help… It says:

Inside of a console.log, create a random number with Math.random, then multiply it by 100.
If you run the program few times, you’ll see random numbers in the console.

I put: console.log(Math.floor(Math.random() * 50))

Please help T^T? I just wan’t make games to help the gaming community and become a better part of it. :<


#2

?

Inside of a console.log, create a random number with Math.random, then multiply it by 100.

I put: console.log(Math.floor(Math.random() * 50))


#3

Yeah do you know what I did wrong?


#4

You didn’t follow the instructions.


#5

… Could you tell me in better words then? I thought it wanted me to make a random number generator in a console.log then take that number and times it by 100. I read the whole thing and I can’t get a grip on what to do.


#6

Then why did you multiply it by 50 and not 100?


#7

I put: console.log(Math.floor(Math.random() * 100))
Doesn’t work either >_>


#8

Please post a link to the exercise when asking for help with a lesson. Thanks.


#9

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

Sorry? :-/


#10

Are you stuck on Step 1, 2 or 3?


#11

I am on step 1 currently.


#12

Then you have too much code in your intermediate step. The SCT expects,

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

#13

Console*? And that didn’t work… Is it just a bug? I’m new to coding so I might just be plain stupid.


#14

Typo. Read the instruction for step 1.


#15

Inside of a console.log, create a random number with Math.random, then multiply it by 100.

If you run the program few times, you’ll see random numbers in the console.

I did…


#16

So what code did you submit for step 1?


#17

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


#18

Too much code.

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

Save it a few times to see the different results. They should all be floats.


#19

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