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

What are the methods of the Math object

2025-04-03 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/03 Report--

This article mainly introduces "what are the methods of Math objects". In the daily operation, I believe that many people have doubts about the methods of Math objects. The editor consulted all kinds of materials and sorted out simple and easy-to-use operation methods. I hope it will be helpful for you to answer the questions of "what are the methods of Math objects?" Next, please follow the editor to study!

1. Math.min ()

Math.min () is a function in the JS math library that returns the smallest of all passed values to the method.

Math.min (0,150,30,20,-8,200) / /-200

2. Math.max ()

The Math.max () method returns the larger of the two specified numbers.

Math.max (0,150,30,20,-8,200) / / 150

3. Math.round ()

The Math.round () function returns the nearest integer after a number is rounded.

Math.round / / 5 Math.round / / 4

4. Math.sqrt ()

The Math.sqrt () function returns the square root of a number, that is:

Math.sqrt (64) / 8 Math.sqrt (25) / / 5

5. Math.pow ()

The Math.pow () function returns the exponent power of the cardinality (base), that is:

Math.pow (8,2) / / 64

6. Math.floor ()

Math.floor () returns the largest integer less than or equal to a given number.

Math.floor / 4 Math.floor 8.6 / 8

7. Math.random ()

The Math.random () function returns a floating point with pseudorandom numbers ranging from 0 to less than 1, that is, up from 0 (including 0), but excluding 1 (excluding 1), and then you can zoom to the desired range. The implementation selects the initial seed to the random number generation algorithm; it cannot be selected or reset by the user.

Math.random () / 0.15497907645259867

8. Math.cos ()

The Math.cos () function returns the cosine of a numeric value.

Math.cos (0, Math.PI / 180) / 1

9. Math.sin ()

The Math.sin () function returns the sine of a numeric value.

Math.sin (90 * Math.PI / 180) / 1

The Math.ceil () function returns the smallest integer greater than or equal to a given number.

Math.ceil (4. 4) / / 5 at this point, the study of "what are the methods of Math objects" is over. I hope I can solve your doubts. The collocation of theory and practice can better help you learn, go and try it! If you want to continue to learn more related knowledge, please continue to follow the website, the editor will continue to work hard to bring you more practical articles!

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

Development

Wechat

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

12
Report