A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://www.geeksforgeeks.org/javascript/javascript-math-object/ below:

JavaScript Math Object - GeeksforGeeks

JavaScript Math Object

Last Updated : 11 Jul, 2025

JavaScript Math object is used to perform mathematical operations on numbers. All the properties of Math are static and unlike other objects, it does not have a constructor.

We use Math only on Number data type and not on BigInt

Example 1: This example uses math object properties to return their values. 

JavaScript
console.log("Math.LN10: " + Math.LN10);
console.log("Math.LOG2E: " + Math.LOG2E);
console.log("Math.Log10E: " + Math.LOG10E);
console.log("Math.SQRT2: " + Math.SQRT2);
console.log("Math.SQRT1_2: " + Math.SQRT1_2);
console.log("Math.LN2: " + Math.LN2);
console.log("Math.E: " + Math.E);
console.log("Math.PI: " + Math.PI);

Output
Math.LN10: 2.302585092994046
Math.LOG2E: 1.4426950408889634
Math.Log10E: 0.4342944819032518
Math.SQRT2: 1.4142135623730951
Math.SQRT1_2: 0.7071067811865476
Math.LN2: 0.6931471805599453
Math.E: 2.71828...

Example 2: Math object methods are used in this example. 

JavaScript
console.log("Math.abs(-4.7): " + Math.abs(-4.7)); 
console.log("Math.ceil(4.4): " + Math.ceil(4.4)); 
console.log("Math.floor(4.7): " + Math.floor(4.7)); 
console.log("Math.sin(90 * Math.PI / 180): " +
        Math.sin(90 * Math.PI / 180)); 
console.log("Math.min(0, 150, 30, 20, -8, -200): " +
        Math.min(0, 150, 30, 20, -8, -200)); 
console.log("Math.random(): " + Math.random()); 

Output
Math.abs(-4.7): 4.7
Math.ceil(4.4): 5
Math.floor(4.7): 4
Math.sin(90 * Math.PI / 180): 1
Math.min(0, 150, 30, 20, -8, -200): -200
Math.random(): 0.7416861489868538

Supported Browsers:

We have a complete list of JavaScript Math Object methods, to check those please go through the JavaScript Math Complete Reference article



RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4