当前位置:网站首页>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 *^*.
边栏推荐
- Software testing and quality final review
- The RAC cannot connect to the database normally after modifying the scan IP. The ora-12514 problem is handled
- Prometheus + grafana + MySQL master-slave replication + host monitoring
- 匿名页的反向映射
- Is it reliable for the top ten securities companies to register and open accounts? Is it safe?
- Is it reliable for securities companies to register and open accounts? Is it safe?
- The solution of "user account control to continue, please enter administrator user name and password" appears in win10 Professional Edition
- [shangpinhui] project notes
- 微内核Zephyr获众多厂家支持!
- Three step problem of leetcode
猜你喜欢

B_QuRT_User_Guide(27)

软件测试与质量期末复习

B_ QuRT_ User_ Guide(26)

MySQL installation and environment variable configuration

sql主从复制搭建

关于在cmd中MySQL不能插中文数据的原因

Prometheus monitoring (I)

At 19:00 on Tuesday evening, the 8th live broadcast of battle code Pioneer - how to participate in openharmony's open source contribution in multiple directions

PLSQL installation under Windows

Children's unit of 2022 Paris fashion week ended successfully at Wuhan station on June 19
随机推荐
探讨gis三维系统在矿山行业中的应用
Introduction to kubernetes (I)
B_QuRT_User_Guide(27)
asp. Net registration page
【学习笔记】线性基
SQL analysis (query interception analysis for SQL optimization)
块级元素上下左右居中的两个小技巧
22/02/14 study notes
B_QuRT_User_Guide(28)
PC端隐藏滚动条
B_QuRT_User_Guide(29)
Is it reliable for the top ten securities companies to register and open accounts? Is it safe?
At 19:00 on Tuesday evening, the 8th live broadcast of battle code Pioneer - how to participate in openharmony's open source contribution in multiple directions
AI首席架构师8-AICA-高翔 《深入理解和实践飞桨2.0》
GPIO configuration of SOC
Estimation of SQL execution cost by MySQL query optimizer
The solution of "user account control to continue, please enter administrator user name and password" appears in win10 Professional Edition
Introduction to Devops Basics
Unity - Pico开发 输入系统等相关API的使用---C#篇
Connaissez - vous le protocole TCP (2)?