English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية

A Brief Discussion on the Properties and Methods of the Built-in Math Object in JavaScript (Recommended)

Properties:

constructor function reference to the object established

prototype can add properties and methods to objects

E Euler's constant, the base of the natural logarithm (approximately equal to2.718)

LN2 2the natural logarithm (approximately equal to 0.693)

LN10 10the natural logarithm (approximately equal to2.302)

LOG2E with2the logarithm of e with base (approximately equal to1.442)

LOG10E with10the logarithm of e with base434)

PI ∏ value (approximately equal to3.14159)

SQRT1_2 1/2(0.5) the square root (that is, l divided by2the square root, approximately equal to o.707)

SQRT2 2the square root (approximately equal to1.414)

Method:

abs(x) returns the absolute value of a number

acos(x) returns the inverse cosine value of a number

asin(x) returns the inverse sine value of a number

atan(x) returns the value between-PI/2 and PI/2 the inverse tangent value

atan2(y,x) returns the position of (x,y) -angles between PI and PI

ceil(x) returns the largest integer not greater than x after rounding

cos(x) returns the cosine of a number

exp(x) returns the value of E^x

floor(x) returns the smallest integer not less than x after rounding

log(x) returns the natural logarithm with base E

max(x,y) returns the larger number between x and y

min(x,y) returns the smaller number between x and y

pow(x,y) returns the value of y^x

random() returns a number between 1 random function between

round(x) rounds and then takes the integer

sin(x) returns the sine value of a number

sqrt(x) returns the square root of a number

tan(x) returns the tangent of an angle

toSource() displays the source code of the object

valueOf() returns the original value of the mathematical object

That's all for the introduction of the built-in object Math's properties and methods in JavaScript (recommended) that the editor has brought to you. Hope it is helpful to everyone, and please support the shouting tutorial~

You May Also Like