The math object part 2
Math Object Methods
The Math object contains a number of methods that are used for calculations:
For example, the following will calculate the square root of a number.
To get a random number between 1-10, use Math.random(), which gives you a number between 0-1. Then multiply the number by 10, and then take Math.ceil() from it: Math.ceil(Math.random() * 10).
Comments
Post a Comment