当前位置:网站首页>JS rounding tips
JS rounding tips
2022-06-28 08:13:00 【Mediocrity and laziness】
js integer
Actually, it is a small knowledge point, but I feel it is very useful, so I will record it here . We generally js Rounding is used parseInt To round up , For example, the following situation :
But you can also use the following methods 
This operator is a bitwise non operator , This is a binary operator , I'll simply state his principle . The operation rule of bitwise negation is to first convert a number into binary , And then reverse by bit . The first bit is the sign bit , If 1 It means a negative number , All but the sign bits of the first bit are reversed again and then +1, If you want to know more about js Bit operators can refer to the W3C.
Because it is operating numbers in binary form, it will be more efficient and look more compelling , So why not use such a good thing *^*.
边栏推荐
- Is it reliable to open an account by digging money? Is it safe?
- Jenkins' common build trigger and hook services (V)
- Is it reliable to open a new bond registration account? Is it safe?
- sql主从复制搭建
- 2022巴黎时装周儿童单元6.19武汉站圆满落幕
- Study notes 22/1/17
- How to use redis to solve concurrency problems
- Soft test -- software designer -- database design of afternoon questions
- 软件测试与质量期末复习
- asp. Net to search products and realize paging function
猜你喜欢

Prometheus service discovery

Airflow2.x distributed deployment DAG execution failure log cannot be obtained normally

AI首席架构师8-AICA-高翔 《深入理解和实践飞桨2.0》

【尚品汇】项目笔记

The solution of "user account control to continue, please enter administrator user name and password" appears in win10 Professional Edition

Redis cluster deployment and application scenarios

sql分析(查询截取分析做sql优化)

2022第六季完美童模 佛山赛区 初赛圆满落幕

asp. Net datalist to display product information and pictures

Ambari (VII) --- ambari integrated hue4.2 document (valid for personal test)
随机推荐
Do you know TCP protocol (1)?
B_ QuRT_ User_ Guide(27)
B_ QuRT_ User_ Guide(26)
MySQL tablespace parsing
Chenglian premium products donated love materials for flood fighting and disaster relief to Yingde
Is it reliable for flush to register and open an account? Is it safe?
redis02——一篇终结redis的五种数据类型操作命令(可学习、复习、面试、收藏备用)
B_QuRT_User_Guide(29)
Activity implicit jump
Helloword routine for ROS
The preliminary round of the sixth season of 2022 perfect children's model Foshan competition area came to a successful conclusion
Airflow2.1.1 summary of the pits stepped on in actual combat!!
SLAM中常用的雅克比矩阵J
Explanation and application of instr() function in Oracle
SOC serial port configuration
软件测试与质量期末复习
asp. Net to search products and realize paging function
抗洪救灾,共克时艰,城联优品捐赠10万元爱心物资驰援英德
Jacobian matrix J commonly used in slam
【js】-【节流、防抖函数】