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

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. :<

?

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))

Yeah do you know what I did wrong?

You didn’t follow the instructions.

… 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.

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

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

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

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

Sorry? :-/

1 Like

Are you stuck on Step 1, 2 or 3?

I am on step 1 currently.

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

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

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

Typo. Read the instruction for step 1.

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…

So what code did you submit for step 1?

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

Too much code.

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

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

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