Math object in JavaScript
The Math object gives you properties and methods for constants and mathematical functions. Unlike other Global objects, Math is not a constructor. All properties and methods of Math are static (Static) and can be called using Math as an object without having to create it.
The Math object gives you properties and methods for constants and mathematical functions. Unlike other Global objects, Math is not a constructor. All properties and methods of Math are static (Static) and can be called using Math as an object without having to create it.
So, you refer to the constant pi as Math.PI and you call the sine function as Math.sin (x) , where x is the parameter of the method.
Syntax
The syntax for calling properties and methods of Math is as follows:
var pi_val = Math . PI ; var sine_val = Math . sin ( 30 );
Math properties
The table below lists the properties of Math and describes it.
Attribute DescriptionE The E constant, and the base of the natural algorithm (symbol: ln), approximately 2.718 LN2 Natural logarithm of 2, approximately 0.693. LN10 Natural logarithm of 10, approximately 2,302. LOG2E Base 2 Logarithm of E, approximately 1,442. LOG10E Logarithm base 10 of E, approximately 0.434. PI Pi coefficient, approximately 3.14159. SQRT1_2 The square root of 1/2; approximately 0.707. SQRT2 The square root of 2, approximately 1,414.Math methods
The table below lists Math's methods and describes it.
Method Descriptionabs () Returns the absolute value of some acos () Returns arccos (radians value) of some asin () Returns arcsin (radians value) of some atan () Returns arctan (value radians) of some atan2 () Returns inverse trigonometric tang ceil () Returns the smallest integer number greater than or equal to a number cos () Returns cos of a number. exp () Returns E, where N is the parameter, and E is the Euler floor constant () Returns the largest integer smaller than or equal to a log number () Returns the base e-logarithm of a maximum number () Returns the maximum number of 0 or more min () Returns the smallest number of 0 or more pow numbers () Returns the value of (base) (exponent) . random () Returns a random number between two numbers 0 and 1. round () Rounds the number. Returns the value of the nearest integer. sin () Returns the sine of some sqrt () Returns the square root of some tan () Returns the tan of some toSource () Returns the "Math" stringAccording to Tutorialspoint
Previous article: Date object in JavaScript
Next lesson: Regular Expression and RegExp in JavaScript
5 ★ | 1 Vote
You should read it
- 11 tips to solve Math simple but extremely interesting
- How to learn Math on Coolmath4Kids for kids
- How to use MathType to write math formulas
- Effective mobile math solutions
- Tips to Master Math and Cope with Home Assignments Faster
- 3 apps to help kids learn Math for free on Windows 10
- Article: 'What to study Math for?' by a leading security expert Google caused a social network storm
- Microsoft adds Math Solver to Edge browser
- math.h in C
- How to Improve Math Skills
- The fastest way to solve online maths
- Top 3 Math solving applications on the phone
Maybe you are interested
Cash flow from ETFs returns, Bitcoin bounces above the $65,000 mark after hitting a 2-month bottom
How To Fill Your Annual Tax Returns: Tips To Ease Your Life
How to Remove spaces and carriage returns in Word
Function Address - The function returns the address of a cell in Excel (usage, examples, examples)
ENCODEURL function - The function returns a query string with URL code in Excel
FILTERXML - Function that returns specified data from XML content using the specified XPath in Excel