当前位置:网站首页>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 *^*.
边栏推荐
- Generation and verification of JWT token
- How redis solves cache avalanche, breakdown and penetration problems
- 挖财注册开户靠谱吗?安全吗?
- 探讨gis三维系统在矿山行业中的应用
- Prometheus deployment alarm docking QQ mailbox
- Airflow2 configuration windows azure SSO details based on oauth2 protocol
- B_ QuRT_ User_ Guide(28)
- Today's notes 22/1/7
- Ambari (IX) --- use expect to realize no interaction in ambri server setup phase (valid for personal test)
- B_ QuRT_ User_ Guide(27)
猜你喜欢

城联优品向英德捐赠抗洪救灾爱心物资

SOC serial port configuration

Chenglian premium products donated love materials for flood fighting and disaster relief to Yingde

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

设置网页的标题部分的图标

Eslint 语法监测关闭

Prometheus monitoring (I)

redis02——一篇终结redis的五种数据类型操作命令(可学习、复习、面试、收藏备用)

sql主從複制搭建

Redis persistence problem and final solution
随机推荐
About RAC modifying scan IP
SQL analysis (query interception analysis for SQL optimization)
MySQL single table access method
B_ QuRT_ User_ Guide(28)
【学习笔记】线性基
ROS notes (09) - query and setting of parameters
Host is not allowed to connect to this MySQL server
Jacobian matrix J commonly used in slam
Chenglian premium products donated love materials for flood fighting and disaster relief to Yingde
Jenkins' common build trigger and hook services (V)
NLP sequence can completely simulate human brain intelligence
Introduction, compilation, installation and deployment of Doris learning notes
asp. Net datalist when there are multiple data displays
设置网页的标题部分的图标
In flood fighting and disaster relief, the city donated 100000 yuan of love materials to help Yingde
Redis cerebral fissure
你了解TCP协议吗(一)?
Study notes 22/1/18
ROS 笔记(09)— 参数的查询和设置
B_QuRT_User_Guide(27)