


Discuss in detail the properties and methods of the built-in object Math in js (clear at a glance)
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!

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics











How to use WebSocket and JavaScript to implement an online speech recognition system Introduction: With the continuous development of technology, speech recognition technology has become an important part of the field of artificial intelligence. The online speech recognition system based on WebSocket and JavaScript has the characteristics of low latency, real-time and cross-platform, and has become a widely used solution. This article will introduce how to use WebSocket and JavaScript to implement an online speech recognition system.

WebSocket and JavaScript: Key technologies for realizing real-time monitoring systems Introduction: With the rapid development of Internet technology, real-time monitoring systems have been widely used in various fields. One of the key technologies to achieve real-time monitoring is the combination of WebSocket and JavaScript. This article will introduce the application of WebSocket and JavaScript in real-time monitoring systems, give code examples, and explain their implementation principles in detail. 1. WebSocket technology

JavaScript and WebSocket: Building an efficient real-time weather forecast system Introduction: Today, the accuracy of weather forecasts is of great significance to daily life and decision-making. As technology develops, we can provide more accurate and reliable weather forecasts by obtaining weather data in real time. In this article, we will learn how to use JavaScript and WebSocket technology to build an efficient real-time weather forecast system. This article will demonstrate the implementation process through specific code examples. We

JavaScript tutorial: How to get HTTP status code, specific code examples are required. Preface: In web development, data interaction with the server is often involved. When communicating with the server, we often need to obtain the returned HTTP status code to determine whether the operation is successful, and perform corresponding processing based on different status codes. This article will teach you how to use JavaScript to obtain HTTP status codes and provide some practical code examples. Using XMLHttpRequest

Introduction to the method of obtaining HTTP status code in JavaScript: In front-end development, we often need to deal with the interaction with the back-end interface, and HTTP status code is a very important part of it. Understanding and obtaining HTTP status codes helps us better handle the data returned by the interface. This article will introduce how to use JavaScript to obtain HTTP status codes and provide specific code examples. 1. What is HTTP status code? HTTP status code means that when the browser initiates a request to the server, the service

Thread of Despair is a rare card in Blizzard Entertainment's masterpiece "Hearthstone" and has a chance to be obtained in the "Wizbane's Workshop" card pack. Can consume 100/400 arcane dust points to synthesize the normal/gold version. Introduction to the attributes of Hearthstone's Thread of Despair: It can be obtained in Wizbane's workshop card pack with a chance, or it can also be synthesized through arcane dust. Rarity: Rare Type: Spell Class: Death Knight Mana: 1 Effect: Gives all minions a Deathrattle: Deals 1 damage to all minions

Bottom attribute syntax and code examples in CSS In CSS, the bottom attribute is used to specify the distance between an element and the bottom of the container. It controls the position of an element relative to the bottom of its parent element. The syntax of the bottom attribute is as follows: element{bottom:value;} where element represents the element to which the style is to be applied, and value represents the bottom value to be set. value can be a specific length value, such as pixels

A practical guide to using jQuery to quickly replace web page tag attributes. In web development, you often encounter situations where you need to replace web page tag attributes, such as changing the text content of a button from "Click Me" to "Submit", or changing the text content of an image. The link address is changed from "image.jpg" to "new_image.jpg", etc. Using jQuery can make these replacement operations simple and fast. This article will introduce you to how to use jQuery to quickly replace web page tag attributes and provide specific code examples.
