In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-29 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)05/31 Report--
This article mainly introduces "what math classes Javascript has". In daily operation, I believe many people have doubts about what math classes Javascript has. Xiaobian consulted various materials and sorted out simple and easy operation methods. I hope to help you answer the doubts about "what math classes Javascript has"! Next, please follow the small series to learn together!
description
random() returns a random number between 0 and 1. [ 0 , 1 )
The logarithm of ceiling (x) is rounded up.
floor(x) logarithm rounded down.
Round(x) to the nearest whole number.
examples
Math.PI pi console.log (Math.PI); // 3.141592653589793 Math. ceiling (num) rounded up to num console.log(Math. ceiling (4.2)); // 5 Math.floor(num) Rounds num downward console.log(Math.floor(4.2)); // 4 Math.round(num) rounds num to console.log (Math.round(1.8)); // 2 Math.abs(num) console.log(Math.abs(-0.78)); //0.78 Take the absolute value of num Math.pow(value1, value2) returns the value of 1 to the power 2 console.log (Math.pow(2,2)); // 4 returns the value of 1 to the power 2, here returns 2 to the power 2 Math.max(value1, value2, value3...) console.log (Math.max(5,8,47,54)); // 54, Returns the maximum value inside; Math.min(Value 1, Value 2, Value 3...) console.log (Math.min(5,8,47,54)); // 5 return the minimum value inside; Math.random(); Randomly returns decimals between 0 and 1, value range 0.0~1.0 (less than 1.0), random(no value is written inside) console.log(Math.random()*10+1); // Randomly returns decimals between 0 and 1, value range 0.0~1.0 (less than 1.0), random(no value is written inside) Here, if after *10+1, the value range is 1.0~11.0 (but less than 11), the study of "What math classes do Javascript have" is over, hoping to solve everyone's doubts. Theory and practice can better match to help everyone learn, go and try it! If you want to continue learning more relevant knowledge, please continue to pay attention to the website, Xiaobian will continue to strive to bring more practical articles for everyone!
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.