Crazy ,i already write 'console.log',but it told me wrong?


#1

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

as i wrote the exercise :but it always tole me :slight_smile:

crazy me .
thank you for your help


#2

Can’t argue that your code looks fine. I notice in the lesson text that Math.floor() is discussed. What happens if we include that in your expression?

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

P.S. I gave topic a vote because you included the link with your post. Thanks.


#3

the exercise ask me to write:
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 gave the answer:
console.log(Math.random()*100);
but it always told me:
Did you write a console.log?
i do not know what wrong is it ?
you can look at again the picture above


#4

As stated above, there is nothing I can see that is wrong with your code. If it is the SCT (Submission Correctness Test) then we can gain from knowing if the suggested code will pass. Try it and let us know what happens, please.


#5

i tried several times again right now
console.log(Math.random()*100);

but it could not pass .


#6

ok ,it works now .thanks


#7

Which solution passed?

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

or,

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

#8

when i wrote the first line code ,it passed the first step.
before ,it could not pass the first step,
if i could not pass the first step. it can not arrive the second step code .


#9

Okay, I understand. The suggested code was given in the second step. At least the first step finally let you move on. Best wishes the rest of the way through the track!


#10

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