Tag: ASC uses the priority conditional arithmetic structure to reverse the calculation assignment
The JavaScript operator
Arithmetic operations
Addition Operator (addition): X + y
Subtraction operator (subtraction): x y
Multiplication operator (multiplication): X * y
Division operator (Division): X/Y
Remainder operator (remainder): x% y
Self-increment operator (Increment): ++x or X + +
Self-decrement operator (decrement):--x or x--
Negation operator (Negate):-X
Assignment operations
Comparison operation
Character encoding: All numbers, letters, and other symbols in a computer are numbered. This facilitates data transfer of charCodeAt ()
If it is more than one character, it is compared individually. (Unicode encoding of characters.) This return value is an integer between 0-65535)
Logical operations
logical non , can be used for any value. The first is converted to a Boolean value, then the inverse (also called the inverse operator)
Expected Boolean value: undefined null ' 0 NaN-->false remainder is True
logic with , there are more than two operands, judging whether all two of them will return true
logical OR , two or more operands, judging if there is a return true of two
logic and , logically, are not also known as short-circuit operators.
Example: Var b_flag=true;
var b_flag2=b_flag&& A;
Console.log (B_FLAG2);
var B_flag=false;
var b_flag2=b_flag&& A;
Console.log (B_FLAG2);
Conditional operations
ternary operation: ? :
Precedence of Operators
Priority level |
Type of operation |
Operator uses |
19 |
Parentheses |
() |
18 |
New member access to array access |
. [ ] |
17 |
Function call |
Fn |
16 |
Post Increment and decrement |
++ - - |
15 |
Logical non, forward increment decrement typeof |
! ++ - - |
14 |
Multiplication to take the remainder |
* / % |
13 |
Add and Subtract |
+ - |
11 |
Greater than or equal to |
< > = |
10 |
equals all equals not equals not equal to |
== === != !== |
6 |
Logic and |
&& |
5 |
Logical OR |
|| |
4 |
Ternary operations |
? : |
3 |
Assign value |
= |
|
|
|
1, good at using parentheses operator
2, remember the precedence of operators
Assignment is very low, the right expression is evaluated first, and then the left side is assigned
Program Order Execution Structure
The sequential structure of the program is strictly in accordance with the code in the program execution, if there is a choice structure, according to the specific conditions
Execute the appropriate code. The loop structure will also have conditional judgments, which will execute different code depending on the situation. Some
There are also interactive technologies that respond to user requirements or external circumstances.
The JavaScript operator