Math is one of the internal objects in JavaScript and is used primarily to handle mathematical tasks and is a static object. Unlike other dynamic objects such as date, string, and so on, it does not have a constructor, math (), and can use properties and methods directly.
For example, use the GETDATE () method of the Date object to get a day in one months:
var New Date (); // 1. Creating an Object instance var nowdate = Date.getdate (); // 2. Using the GETDATE () method
The Math object uses the random () method directly to produce a 0-1 stochastic number:
var x = Math.random (); // Direct Use
Math Object Properties
document.write (Math.PI); // Output 3.141592653589793
document.write (math.e+ "<br/>");//Output 2.718281828459045document.write (math.ln2+ "<br/>");//Output 0.6931471805599453document.write (math.ln10+ "<br/>");//Output 2.302585092994046document.write (math.log2e+ "< Br/> ");//Output 1.4426950408889634document.write (math.log10e+" <br/> ");//Output 0.4342944819032518document.write (math.sqrt1_2+ "<br/>");//Output 0.7071067811865476document.write (math.sqrt2+ "<br/>");//Output 1.4142135623730951
Math Object Method
JavaScript Internal object (1)--math object