In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/01 Report--
This article will explain in detail the example analysis of numbers in js. The editor thinks it is very practical, so I share it for you as a reference. I hope you can get something after reading this article.
Different binary representations of the number 1
Different binary writing formats have been added to ES6, which should be noted when passing parameters in the background.
29 / 10 035 / / Octal 29 original way 0o35 / / octal 29 ES6 way 0x1d / / hexadecimal 290b11101 / / 2 is accurate to a specified number of decimal places
Rounds the number to the specified number of decimal places. Rounds the number to the specified number of decimal places using Math.round () and template literals. Omit the second parameter, decimals, and the number is rounded to an integer.
Const round = (n, decimals = 0) = > Number (`${Math.round (` ${n} e$ {decimals} `)} eMerle ${decimals}`) round (1.345, 2) / / 1.35round (1.345, 1) / / 1.33 Digital complement 0 operation
Thanks to netizens @ JserWang @ vczhan for providing this tip
Sometimes, for example, when displaying the time, it is sometimes necessary to display one digit as two digits. In this case, you need to fill in 0. You can use the padStart method of slice and string.
Const addZero1 = (num, len = 2) = > (`0 ${num} `). Slice (- len) const addZero2 = (num, len = 2) = > (` ${num} `) .padStart (len,'0') addZero1 (3) / 03addZero2 (32 addZero1 4) / / 0032 this is the end of the article on "sample Analysis of numbers in js". I hope the above can be helpful to you, so that you can learn more knowledge, if you think the article is good. Please share it for more people to see.
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.