JavaScript Math ObjectMath Objec

The built-in Math object includes mathematical constants and functions. You do not need to create the Math object before using it.

To store a random number between 0 and 1 in a variable called “r_number”:

r_number=Math.random()

To store the rounded number of 8.6 in a variable called “r_number”:

r_number=Math.round(8.6)

The Math object’s properties and methods are described below:

NN: Netscape, IE: Internet ExplorerProperties

Syntax: object.property_name

Leave a Reply

Your email address will not be published. Required fields are marked *