
- Javascript Basics Tutorial
- Javascript - Home
- Javascript - Overview
- Javascript - Syntax
- Javascript - Enabling
- Javascript - Placement
- Javascript - Variables
- Javascript - Operators
- Javascript - If...Else
- Javascript - Switch Case
- Javascript - While Loop
- Javascript - For Loop
- Javascript - For...in
- Javascript - Loop Control
- Javascript - Functions
- Javascript - Events
- Javascript - Cookies
- Javascript - Page Redirect
- Javascript - Dialog Boxes
- Javascript - Void Keyword
- Javascript - Page Printing
- JavaScript Objects
- Javascript - Objects
- Javascript - Number
- Javascript - Boolean
- Javascript - Strings
- Javascript - Arrays
- Javascript - Date
- Javascript - Math
- Javascript - RegExp
- Javascript - HTML DOM
- JavaScript Advanced
- Javascript - Error Handling
- Javascript - Validations
- Javascript - Animation
- Javascript - Multimedia
- Javascript - Debugging
- Javascript - Image Map
- Javascript - Browsers
- JavaScript Useful Resources
- Javascript - Questions And Answers
- Javascript - Quick Guide
- Javascript - Functions
- Javascript - Resources
What is math object in JavaScript?
The math object has 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.
Thus, you refer to the constant pi as Math.PI and you call the sine function as Math.sin(x), where x is the method's argument.
The syntax to call the properties and methods of Math are as follows −
var pi_val = Math.PI; var sine_val = Math.sin(60);
You can try to run the following code to learn how to implement math object in JavaScript. Here, we’re working on Math PI property to return the ratio of the circumference of a circle to its diameter which is approximately 3.14159 −
Example
<html> <head> <title>JavaScript Math PI Property</title> </head> <body> <script> var property_value = Math.PI document.write("Property Value (PI) : " + property_value); </script> </body> </html>
Output
Property Value (PI) : 3.141592653589793
- Related Articles
- What is Math Object in JavaScript Program?
- JavaScript Math Object example
- What are JavaScript Math Functions?
- Math. fround() function in JavaScript
- Math. hypot() function in JavaScript
- What is arguments object in JavaScript?
- What is date object in JavaScript?
- What is WeakSet Object in JavaScript?
- What is JavaScript object Destructuring?
- What is a Global Object in JavaScript?
- Implementing Math function and return m^n in JavaScript
- What is an Object Oriented Programming in JavaScript?
- Get minimum number without a Math function JavaScript
- What is the role of Navigator object in JavaScript?
- What is the use of proxy() object in JavaScript?

Advertisements