当前位置:网站首页>JS operator
JS operator
2022-07-25 11:47:00 【c_ perfectworld】
Operator
Also known as The operator , Used to implement assignment 、 Symbols for functions such as comparison and arithmetic operations
JS Common operators in
- Arithmetic operator
- Increment and decrement operators
- Comparison operator
- Logical operators
- Assignment operator
Arithmetic operator
Symbols used in arithmetic operations , Used to perform arithmetic operations on two variables or values

Try not to use floating-point numbers to participate in operations , There will be errors
expression :
By digital 、 Operator 、 A formula composed of variables
In the end, there will be a result , Back to us , It's called the return value
Increment and decrement operators
Let the numerical variable be added repeatedly 1 Sum minus 1, have access to Increasing (++) and Decline (--) Operator to complete
++ and -- Put it in Before variable , be called Pre increment ( Decline ) Operator , Put it in After variables when , be called Post increment ( Decline ) Operator
Be careful : The increment decrement operator must be used with variables
++num amount to num = num + 1
Pre increment operator :
Add it first , Then return the value
Post increment operator :
num++ Post increment , It's self imposed 1
Return the original value first , Post autoplus
Summary :
- When used alone , The running results are the same
- When used in conjunction with other codes , The results will be different
- After : First the original value operation , Post autoplus
- In front of : Add it first , Post operation
- Most developers use post , And the code has a single line
Comparison operator
The operator used to compare two data , After comparison , Meeting Returns a Boolean value (true / false) As a result of the comparison operation

== Default conversion data type , It can convert string data type to numeric data type
=== The values and data types on both sides need to be completely consistent

Logical operators
The operator used to perform Boolean operations , Its return value is also Boolean , Later development is often used to judge multiple conditions

&& On both sides true Will return true, Otherwise return to false
| | On one side, true return true, On both sides false return false
! Also known as Inverse character , Used to take a value that is the opposite of a Boolean value
Short-circuit operation ( Logic break )
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
- grammar : expression 1 && expression 2
- If the first expression is true , Then return the expression 2
- If the first expression is false , Then return the expression 1
Logic or
- grammar : expression 1 && expression 2
- If the first expression is true , Then returns the first expression
- If the first expression is false , Returns the second expression
Assignment operator
Operators used to assign data to variables

Operator priority

- In unary operators Logical non priority is high
- Logic and is higher than logic or priority
边栏推荐
- Summary of combination problems of Li Kou brush questions (backtracking)
- 教你如何通过MCU配置S2E为TCP Server的工作模式
- Database integrity -- six constraints learning
- Leetcode sword finger offer 27. image of binary tree
- The first C language program (starting from Hello World)
- SQL language (V)
- Fillet big killer, use filter to build fillet and wave effect!
- Txt to CSV file, blank lines appear every other line
- leetcode 剑指 Offer 28. 对称的二叉树
- JVM performance tuning methods
猜你喜欢

Talking about Devops monitoring, how does the team choose monitoring tools?

The principle analysis of filter to solve the request parameter garbled code

MIIdock简述

Small and micro enterprise smart business card management applet
Details of the list of state products that Apple announced to be eligible for the sales tax holiday in the United States

Maskgae: masked graph modeling meets graph autoencoders
![[leetcode brush questions]](/img/86/5f33a48f2164452bc1e14581b92d69.png)
[leetcode brush questions]

【USB设备设计】--复合设备,双HID高速(64Byte 和 1024Byte)

模型部署简述

leetcode 剑指 Offer 27. 二叉树的镜像
随机推荐
[recursion] 938. Range and of binary search tree
Similarity matrix, diagonalization condition
常见WEB攻击与防御
Mlx90640 infrared thermal imager temperature measurement module development notes (V)
Only know that the preform is used to generate objects? See how I use unity to generate UI prefabs
Shell Chapter 7 exercise
相似矩阵,可对角化条件
擎创科技加入龙蜥社区,共建智能运维平台新生态
城市雕塑典型作品信息管理系统(图片分享系统SSM)
Hacker introductory tutorial (very detailed) from zero basic introduction to proficiency, it is enough to read this one.
Reflection reflection
Eigenvalues and eigenvectors of matrices
Introduction to shortcut keys in debug chapter
Shell fourth day homework
Some errors of tensorflow calling multiple GPUs
JaveScript循环
Wiznet embedded Ethernet technology training open class (free!!!)
WIZnet嵌入式以太网技术培训公开课(免费!!!)
SQL language (III)
How to judge the performance of static code quality analysis tools? These five factors must be considered