<Below this line, in what way does your code behave incorrectly? Include ALL error messages.>
I defined a variable as a random number and tried to multiply it by 100. Although the random number is getting generated and but I am not able to go through with the multiplication.
var myNum = console.log(Math.floor(Math.random()*50))
@mahvash the random number expression you created is going to give you a result between 0 and 50 Math.random()*50
Math.floor will round the number down, while Math.ceil will round the number up. Math.floor(Math.random()*50)
Assuming the rest of the code is correct
Your console statement will most likely give you a number between 0-4,900
However, in your first line of code, the variable myNum has been assigned a console.log statement var myNum = console.log(Math.floor(Math.random()*50));
AND the second line of code is assuming that the variable myNum holds a numeric value, which it does not and will result in an error console.log(myNum*100)
It’s always good to find the reason why we are wrong.
The log method does not have a return value, so myNum will be undefined.
In JS, operators have a return value, so = will return a value. Consequently we can make an assignment in the expression we pass to console.log(). Don’t try this in the lessons, though, or it won’t pass. The pattern is not recognized by the SCT.