---
title: "What is work of Math object in JS?"  
description: "What is work of Math object in JS?"  
author: "Ravi Vishwakarma"  
published: 2021-07-19  
canonical: https://answers.mindstick.com/qa/93742/what-is-work-of-math-object-in-js  
category: "web application"  
tags: ["javascript", "web application development", "web development"]  
reading_time: 2 minutes  

---

# What is work of Math object in JS?

What is work of [Math](https://www.mindstick.com/articles/23293/5-great-marketing-jobs-for-math-geeks) [object in JS](https://answers.mindstick.com/qa/93745/what-are-the-need-of-random-object-in-js)?

## Answers

### Answer by user

Math is a built-in object that has properties and methods for mathematical constants and functions. It’s not a function object. Math works with the Number type. It doesn't work with BigInt. The math object provides you properties and methods for mathematical constants and functions. Unlike other global objects, Math is not a constructor. All the properties and methods of Math are static and can be called by using Math as an object without creating it. **Syntax:**

```
 Variable-name = Math.property-name or function-name();
```

**Example1:**

```
<!DOCTYPE html>
<html lang='en' xmlns='http://www.w3.org/1999/xhtml'>
<head>
    <meta charset='utf-8' />
    <title></title>
</head>
<body>
<h2>JavaScript Math Object</h2>
<p>Math.PI returns PI:</p>
<p id='piDemo'></p>
<p>Math.sqrt(16) returns the square root of 16:</p>
<p id='sqrtDemo'></p>
<script>
    var x = Math.PI;
    var y = Math.sqrt(16);
    document.getElementById('piDemo').innerHTML = x;
    document.getElementById('sqrtDemo').innerHTML = y;
</script>
</body>
</html>
```

**Exampl2:**

```
console.log(Math.max(1, 3, 2));
// expected output: 3
console.log(Math.max(-1, -3, -2));
// expected output: -1
const array1 = [1, 3, 2];
console.log(Math.max(...array1));
// expected output: 3
```

\

### Answer by Ethan Karla

Math object, have constants and functions. It is not a function object. Math object works with number types. The Math object gives you function and properties for mathematical constants and functions. Math does not have a constructor. All properties and methods of math are static and can be called using math as an object without creating it.

```
syntax:variable-name = Math.property-name or function-name();
```

```
Math.PIRatio of a circle's circumference to its diameter; approximately 3.14159.
```

```
Math.SQRT2Square root of 2; approximately 1.414.
```

```
Static methodsMath.abs(x) Returns the absolute value of x.
```

Example

```
<!DOCTYPE html>
<html lang='en' xmlns='http://www.w3.org/1999/xhtml'>
<head>
    <meta charset='utf-8' />
    <title></title>
</head>
<body>
<h2>JavaScript Math Object</h2>
<p>Math.PI returns PI value</p>
<p id='piDemo'></p>
<p>Math.sqrt(16) returns the square root of 16:</p>
<p id='sqrtDemo'></p>
<script>
    var x = Math.PI;
    var y = Math.sqrt(16);
    document.getElementById('piDemo').innerHTML = x;
    document.getElementById('sqrtDemo').innerHTML = y;
</script>
</body>
</html>
```

Output

```
JavaScript Math Object
Math.PI returns PI value
3.141592653589793
Math.sqrt(16) returns the square root of 16:
4
```


---

Original Source: https://answers.mindstick.com/qa/93742/what-is-work-of-math-object-in-js

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
