Methods of js Math object_basic knowledge
1. Discard the decimal part and keep the integer part
parseInt(5/2)
2. Round up, if there is a decimal, add 1 to the integer part
Math .ceil(5/2)
3, round down.
Math.round(5/2)
4, round down
Math .floor(5/2)
Math object method
FF: Firefox, IE: Internet Explorer
方法 | 描述 | FF | IE |
---|---|---|---|
abs(x) | 返回数的绝对值。 | 1 | 3 |
acos(x) | 返回数的反余弦值。 | 1 | 3 |
asin(x) | 返回数的反正弦值。 | 1 | 3 |
atan(x) | 以介于 -PI/2 与 PI/2 弧度之间的数值来返回 x 的反正切值。 | 1 | 3 |
atan2(y,x) | 返回从 x 轴到点 (x,y) 的角度(介于 -PI/2 与 PI/2 弧度之间)。 | 1 | 3 |
ceil(x) | 对数进行上舍入。 | 1 | 3 |
cos(x) | 返回数的余弦。 | 1 | 3 |
exp(x) | 返回 e 的指数。 | 1 | 3 |
floor(x) | 对数进行下舍入。 | 1 | 3 |
log(x) | 返回数的自然对数(底为e)。 | 1 | 3 |
max(x,y) | 返回 x 和 y 中的最高值。 | 1 | 3 |
min(x,y) | 返回 x 和 y 中的最低值。 | 1 | 3 |
pow(x,y) | 返回 x 的 y 次幂。 | 1 | 3 |
random() | 返回 0 ~ 1 之间的随机数。 | 1 | 3 |
round(x) | 把数四舍五入为最接近的整数。 | 1 | 3 |
sin(x) | 返回数的正弦。 | 1 | 3 |
sqrt(x) | 返回数的平方根。 | 1 | 3 |
tan(x) | 返回角的正切。 | 1 | 3 |
toSource() | 返回该对象的源代码。 | 1 | - |
valueOf() | 返回 Math 对象的原始值。 | 1 | 4 |

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

AI Hentai Generator
Generate AI Hentai for free.

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



Essential tools for stock analysis: Learn the steps to draw candle charts in PHP and JS. Specific code examples are required. With the rapid development of the Internet and technology, stock trading has become one of the important ways for many investors. Stock analysis is an important part of investor decision-making, and candle charts are widely used in technical analysis. Learning how to draw candle charts using PHP and JS will provide investors with more intuitive information to help them make better decisions. A candlestick chart is a technical chart that displays stock prices in the form of candlesticks. It shows the stock price

Face detection and recognition technology is already a relatively mature and widely used technology. Currently, the most widely used Internet application language is JS. Implementing face detection and recognition on the Web front-end has advantages and disadvantages compared to back-end face recognition. Advantages include reducing network interaction and real-time recognition, which greatly shortens user waiting time and improves user experience; disadvantages include: being limited by model size, the accuracy is also limited. How to use js to implement face detection on the web? In order to implement face recognition on the Web, you need to be familiar with related programming languages and technologies, such as JavaScript, HTML, CSS, WebRTC, etc. At the same time, you also need to master relevant computer vision and artificial intelligence technologies. It is worth noting that due to the design of the Web side

How to use PHP and JS to create a stock candle chart. A stock candle chart is a common technical analysis graphic in the stock market. It helps investors understand stocks more intuitively by drawing data such as the opening price, closing price, highest price and lowest price of the stock. price fluctuations. This article will teach you how to create stock candle charts using PHP and JS, with specific code examples. 1. Preparation Before starting, we need to prepare the following environment: 1. A server running PHP 2. A browser that supports HTML5 and Canvas 3

With the rapid development of Internet finance, stock investment has become the choice of more and more people. In stock trading, candle charts are a commonly used technical analysis method. It can show the changing trend of stock prices and help investors make more accurate decisions. This article will introduce the development skills of PHP and JS, lead readers to understand how to draw stock candle charts, and provide specific code examples. 1. Understanding Stock Candle Charts Before introducing how to draw stock candle charts, we first need to understand what a candle chart is. Candlestick charts were developed by the Japanese

Here's how to convert a MySQL query result array into an object: Create an empty object array. Loop through the resulting array and create a new object for each row. Use a foreach loop to assign the key-value pairs of each row to the corresponding properties of the new object. Adds a new object to the object array. Close the database connection.

In PHP, an array is an ordered sequence, and elements are accessed by index; an object is an entity with properties and methods, created through the new keyword. Array access is via index, object access is via properties/methods. Array values are passed and object references are passed.

The Request object in PHP is an object used to handle HTTP requests sent by the client to the server. Through the Request object, we can obtain the client's request information, such as request method, request header information, request parameters, etc., so as to process and respond to the request. In PHP, you can use global variables such as $_REQUEST, $_GET, $_POST, etc. to obtain requested information, but these variables are not objects, but arrays. In order to process request information more flexibly and conveniently, you can

The relationship between js and vue: 1. JS as the cornerstone of Web development; 2. The rise of Vue.js as a front-end framework; 3. The complementary relationship between JS and Vue; 4. The practical application of JS and Vue.
