当前位置:网站首页>JS learning notes - operators
JS learning notes - operators
2022-07-02 16:04:00 【Dumb monkey】
Operator ( operator ) Also known as the operator , Is used to implement assignment 、 Symbols that compare and perform functions such as arithmetic operations .
The precision of floating point numbers
The highest precision of a floating-point value is 17 Decimal place , But the accuracy of arithmetic calculation is far less than integer .
Increment and decrement operators
If you need to add or subtract numbers repeatedly 1 , have access to Increasing ( ++ ) And decline ( -- ) Operator To complete .
stay JavaScript in , Increasing ( ++ ) And decline ( -- ) You can put it in front of a variable , You can also put it after variables . When you put it in front of a variable , We can call it Pre increment ( Decline ) Operator , When you put it after a variable , We can call it Post increment ( Decline ) Operator .
Increment and decrement operators must be used with variables .
Pre increment and post increment operators can simplify the writing of code , Let the value of the variable + 1 Easier to write than before
When used alone , The running results are the same , When used with other code , The execution results will be different .
After : First the original value operation , Post autoplus ( Put the interest of others above one's own )
In front of : Add it first , Post operation ( First, then )
Comparison operator
The equal sign in our program is == Default conversion data type Will convert string data to numeric data
Logical operators
Logical operators are used to Operators that perform Boolean operations , Its return value is also Boolean .
Logic and && and On both sides true The result is true As long as there is Side is false The results for false
Logic or || or On both sides false It turns out to be false false As long as there is one Side is true junction The result is true
Logic is not (!) It's also called the negation , Used to take a value that is the opposite of a Boolean value , Such as true The opposite of this is false
Short-circuit operation ( Logic break )
Logic and short circuit operation
The principle of short circuit operation : When there are multiple expressions ( value ) when , When the value of the expression on the left can determine the result , The value of the expression on the right will no longer be evaluated ;
Logic and short circuit operation : If the expression 1 The result is true , Then return the expression 2. If the expression 1 For false , Then the return expression 1
If the empty or negative is false, the rest is true .eg: 0 ' ' null undefined NaN
Logic or short circuit operation
Logical or short circuit operation if expression 1 If the result is true, the expression is returned 1 If the expression 1 Returns an expression if the result is false 2
Assignment operator
Operator priority
边栏推荐
- 《大学“电路分析基础”课程实验合集.实验六》丨典型信号的观察与测量
- Wavedec2 in MATLAB, talk about the wavedec2 function [easy to understand]
- Strings and arrays
- Fiddler realizes mobile packet capturing - getting started
- After the win10 system is upgraded for a period of time, the memory occupation is too high
- Summary of multithreading and thread synchronization knowledge
- Invalid bound statement (not found)解决方法总结
- What are the necessary functions of short video app development?
- [solution] educational codeforces round 82
- Jsp+mysql006 community management system
猜你喜欢
Mobile web development learning notes - Layout
隐藏在 Nebula Graph 背后的星辰大海
Comment réaliser un graphique Nebula d'importation CSV hors ligne de niveau milliard
Register as a harmonios developer and install deveco studio 3.0 beta2 for harmonios
原神2.6服务端下载以及搭建安装教程
[5g NR] RRC connection release
【5G NR】RRC连接释放
mysql 计算经纬度范围内的数据
Xpt2046 four wire resistive touch screen
XPT2046 四线电阻式触摸屏
随机推荐
Bean configuration override in boot
Register as a harmonios developer and install deveco studio 3.0 beta2 for harmonios
Golang MD5 encryption and MD5 salt value encryption
AWS云主机扩容
Practice of constructing ten billion relationship knowledge map based on Nebula graph
idea 公共方法抽取快捷键
Introduction to Dynamic Planning II (5.647.62)
Wavedec2 in MATLAB, talk about the wavedec2 function [easy to understand]
[Xiaobai chat cloud] suggestions on container transformation of small and medium-sized enterprises
Data Lake (11): Iceberg table data organization and query
Postgressql stream replication active / standby switchover primary database no read / write downtime scenario
构建多架构镜像的最佳实践
纪念成为首个 DAYU200 三方 demo 贡献者
仙人掌之歌——投石问路(2)
【小白聊云】中小企业容器化改造建议
图数据库|Nebula Graph v3.1.0 性能报告
Summary of multithreading and thread synchronization knowledge
Compress words (kmp/ string hash, double hash)
源码look me
【5G NR】RRC连接释放