Home > Web Front-end > JS Tutorial > Discuss in detail the properties and methods of the built-in object Math in js (clear at a glance)

Discuss in detail the properties and methods of the built-in object Math in js (clear at a glance)

亚连
Release: 2018-05-19 16:08:46
Original
1547 people have browsed it

The following editor will bring you a detailed discussion of the properties and methods of the built-in object Math in js. Let me share it with you now and give it as a reference for everyone.

Attributes:

constructor function reference of the created object

prototype attributes and methods that can be added to the object

E Euler’s constant, the base of the natural logarithm (approximately equal to 2.718)

LN2 The natural logarithm of 2 (approximately equal to 0.693)

LN10 The natural logarithm of 10 (approximately Equal to 2.302)

LOG2E The logarithm of e with base 2. (approximately equal to 1.442)

LOG10E The logarithm of e with base 10 (approximately equal to 0.434)

The value of PI ∏ (approximately equal to 3.14159)

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

SQRT2 2 Square root (approximately equal to 1.414)

Method:

abs(x) Returns the absolute value of the number

acos(x ) Returns the arc cosine of a number

asin(x) Returns the arc sine of a number

atan(x) Returns the arc tangent between -PI/2 and PI/2

atan2(y,x) Returns the angle of (x,y) between -PI and PI

ceil(x) Returns the largest integer of x after rounding

cos(x ) Returns the cosine of a number

exp(x) Returns the E^x value

floor(x) Returns the smallest integer of x after rounding

log(x) Returns The base is the natural logarithm of E

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

min(x,y) Returns the smaller number between x and y Number

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

random() Returns a random function between 0 and 1

round(x) after rounding Rounding

sin(x) Returns the sine of a number

sqrt(x) Returns the square root of a number

tan(x) Returns the tangent of an angle

toSource() Display the source code of the object

valueOf() Return the original value of the mathematical object

The above is what I compiled for everyone. I hope it will be helpful to everyone in the future.

Related articles:

js object Existence judgment_javascript skills

JS object attributes related (check Properties, enumeration properties, etc.)_javascript skills

JS object introduction_js object-oriented

The above is the detailed content of Discuss in detail the properties and methods of the built-in object Math in js (clear at a glance). For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template