Operators on the basis of JavaScript
- 2021-12-05 05:31:31
- OfStack
1. Operators
Operators (operator), also known as operators, are symbols used to perform functions such as assignment, comparison and arithmetic operations.
Commonly used operators in JavaScript are:
Arithmetic operators (+,-, *,/,%) Increment and decrement operators (+ + num, num + +,--num, num--) Comparison operator Logical operator Assignment operatorAssignment operation:
var a = 1; // Put the value on the right into the variable on the left
Comparison operation:
Comparison operation-refers to the size comparison of numbers: > < > = < = The result of comparison operation 1 must be a Boolean valueLogical operations:
Logical operation symbol: & & (And) (or)! Non/inverse & & Sum is used to connect two conditions-to form a large condition judgment resultSelf-increasing and self-decreasing operation:
+ + Self-increasing symbol
When the + + symbol touches the output, the symbol is behind, and then the + + is last, and the output is first
console.log( a++ );
When the + + symbol hits the output, the symbol comes first, then the + + is carried out first, and then the output
console.log(++a);
The minus sign is the same
-Self-subtracting symbol
Summarize
This article is here, I hope to give you help, but also hope that you can pay more attention to this site more content!