Math.random()
Math.random()
returns a random number between 0 (inclusive), and 1 (exclusive):
Example
// Returns a random number:
Math.random();
Math.random()
always returns a number lower than 1.
JavaScript Random Integers
Math.random()
used with Math.floor()
can be used to return random integers.
There is no such thing as JavaScript integers.
We are talking about numbers with no decimals here.