+1

Randomize in JavaScript

I cannot randomize my variable. Can someone please tell me why? My code is: var fish = math.random What is wrong?

1/13/2018 9:26:09 PM

Roman

3 Answers

New Answer

+4

Math.random() instead of math.random. This will return a value between 0 and 1.

+3

Math.random (you must use 'Math' and not 'math') refer to the method itself of Math object... if you want to run it, you need to append a parenthesis pair to it for calling it, else you only assign the method reference and not the computed value ^^

+1

Thank You!