当前位置:网站首页>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

边栏推荐
- 解决BASE64Encoder报错的问题
- /Bin/ld: cannot find -lssl
- Aiko ai Frontier promotion (7.2)
- Strings and arrays
- Summary of multithreading and thread synchronization knowledge
- Idea jar package conflict troubleshooting
- How to use percona tool to add fields to MySQL table after interruption
- [Xiaobai chat cloud] suggestions on container transformation of small and medium-sized enterprises
- In memory of becoming the first dayu200 tripartite demo contributor
- 将点云坐标转换成世界坐标的demo
猜你喜欢

HMS core machine learning service helps zaful users to shop conveniently

愛可可AI前沿推介(7.2)

结构体的内存对齐

The sea of stars hidden behind the nebula graph

处理gzip: stdin: not in gzip formattar: Child returned status 1tar: Error is not recoverable: exitin

Review materials for the special topic of analog electronics with all essence: basic amplification circuit knowledge points

Recommended practice sharing of Zhilian recruitment based on Nebula graph

手机app通达信添加自定义公式(分时T+0)为例子讲解

JS learning notes - first acquaintance

After the win10 system is upgraded for a period of time, the memory occupation is too high
随机推荐
数仓中的维度表与事实表
Add user-defined formula (time sharing t+0) to mobile app access as an example
Solve the problem of base64encoder error
[5g NR] RRC connection release
Use ffmpeg command line to push UDP and RTP streams (H264 and TS), and ffplay receives
Fiddler realizes mobile packet capturing - getting started
Experiment collection of University "Fundamentals of circuit analysis". Experiment 6 - observation and measurement of typical signals
In memory of becoming the first dayu200 tripartite demo contributor
《大学“电路分析基础”课程实验合集.实验七》丨正弦稳态电路的研究
多数据源配置代码
2020.4.12 byte written test questions B DP D monotone stack
Construction and business practice of Zhongke brain knowledge map platform
Digital collection system development (program development) - Digital Collection 3D modeling economic model system development source code
idea jar包冲突排查
【5G NR】RRC连接释放
Idea jar package conflict troubleshooting
AWS virtual machine expansion
beforeEach
/Bin/ld: cannot find -llz4
蚂蚁集团大规模图计算系统TuGraph通过国家级评测