Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Is math the built-in function of javascript?

2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)05/31 Report--

Today, I would like to share with you the relevant knowledge that math is the built-in function of javascript. The content is detailed and the logic is clear. I believe most people still know too much about this, so share this article for your reference. I hope you can get something after reading this article. Let's take a look at it.

Math is a javascript built-in object, not a built-in function. Math object is used to perform mathematical calculations, it contains properties and methods, and its properties include standard mathematical constants, such as pi constant PI;, whose methods constitute a library of mathematical functions, including geometric and arithmetic functions.

The operating environment of this tutorial: windows7 system, javascript1.8.5 version, Dell G3 computer.

Math is a javascript built-in object.

The built-in object is an object already written by js itself, and we can use it directly without defining it. Common built-in objects in javascript include:

String object: a string object that provides properties and methods for manipulating strings.

Array object: an array object that provides properties and methods for array manipulation.

Date object: a date-time object that can get the date-time information of the system.

Boolean object: a Boolean object. A Boolean variable is a Boolean object. (no properties and methods are available)

Number object: numeric object. A numerical variable is a numeric object.

Math object: a mathematical object that provides properties and methods for mathematical operations.

RegExp

Error

Global

The Math object is used to perform mathematical calculations. It also contains attributes and methods, and its properties include standard mathematical constants, such as pi constant PI;, whose methods constitute a library of mathematical functions, including geometric and arithmetic functions. These methods and constants of the Math object are static, so instead of creating a Math object, you directly use the Math object name to access properties or methods, such as Math.PI,Math.random ().

Some common methods for Math objects are listed below.

The method describes that sin (x) returns the sine of x, the parameter x represents the cosine of x returned by cos (x) in radians, the parameter x represents the tangent of x returned by tan (x) in radians, the parameter x represents the inverse cosine of x returned by acos (x) in radians, and the parameter x must be a number between-1.0 ~ 1.0 and asin (x) returns the arcsine of x. Parameter x must be a number between-1.0 and 1.0, atan (x) returns the arc tangent of x, parameter x must be the absolute value of x returned by 1 numeric abs (x), parameter x must be a numeric ceil (x) that returns the smallest integer greater than or equal to x, parameter x must be the value of a numeric exp (x) returning the x th act of e, and parameter x must be any numeric value or expression floor (x).

Returns the largest integer less than or equal to x, and the parameter x must be a numeric value

Log (x) returns the natural logarithm of x, and the parameter x is any numeric value or the expression max (x1menx2)

Returns the maximum value in x1 and x2. The parameters x1 and x2 must be numeric.

Min (x1 ~ x2)

Returns the minimum value in x1 and x2. The parameters x1 and x2 must be numeric.

Pow (x1) returns x2 power of x1. Parameters x1 and x2 must be numeric random () to generate a random floating point number round (x) between 0 and 1.0 (including 0 but not 1.0). Round (x) returns the integer rounded by num, the parameter x must be a numeric sqrt (x) that returns the square root of x, and the parameter x must be greater than or equal to 0, which is all the content of the article "is math a built-in function of javascript?" Thank you for reading! I believe you will gain a lot after reading this article. The editor will update different knowledge for you every day. If you want to learn more knowledge, please pay attention to the industry information channel.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report