In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)05/31 Report--
This article introduces the relevant knowledge of "what are the Math mathematics classes of Javascript?". In the operation of actual cases, many people will encounter such a dilemma. Next, let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!
Description
1. Random () returns a random number between 0 and 1. [0,1)
2. Ceil (x) logarithm is rounded up.
3. Floor (x) logarithm is rounded down.
4. Round (x) rounds the number to the nearest integer.
Example
Math.PI pi console.log (Math.PI); / 3.141592653589793 pi Math.ceil (num) rounding console.log up to num (Math.ceil (4.2); / 5 rounding Math.floor up to num (num) to num rounding down console.log (Math.floor (4.2)) / 4 rounding num Down Math.round (num) rounding num console.log (Math.round (1.8); / 2 rounding Math.abs (num) to num absolute value console.log (Math.abs (- 0.78)) / 0.78 pair num absolute value Math.pow (value 1, value 2) returns the second power console.log of value 1 (Math.pow (2)) / / 4 returns the value of 1 to the power of 2, here is the Math.max of power 2 (value 1, value 2, value 3.) Take the maximum value of the array in parentheses console.log (Math.max (5, 8, 47, 54); / 54, return the maximum; Math.min (value 1, value 2, value 3.) Take the minimum value of a stack of arrays in parentheses console.log (Math.min (5, 8, 47, 54); / / 5 returns the minimum value in it Math.random (); randomly returns the decimal number between 0 and 1, with a value range of 0. 0 to 1. 0 (less than 1. 0), random (no value to be written in) console.log (Math.random () * 10: 1) / / Randomly returns the decimal between 01s, with a value range of 0.01cm 1.0 (less than 1.0), random (no value is required) here, if the value range is 1.0 to 11.0 (but not 11) after * 101s, the content of "what are the Math math classes of Javascript" is introduced here, thank you for your reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!
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.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.