Two javascript02 basic syntax-operators
(i) Arithmetic operators: plus (+), minus (-), multiply (*), divide (/), remainder (%)
* Add, subtract, multiply, divide, remainder, and arithmetic in mathematics for example: 9/2=4.5,4*5=20,9%2=1
*-In addition to representing a minus sign, you can also indicate a minus sign for example: X=-y
* + In addition to the connection can be used to indicate that the addition operation can also use strings for example: "abc" + "def" = "abcdef"
PS: By forcing a type conversion, the plus sign can also concatenate variables of different types and perform different operations by converting to a number or string:
Number + String: Number + String Example: "abc" = "3abc"
Number + Boolean: true?1,false?0 for example: 4+true=5
String + Boolean: Boolean value? string "true" and "false" for example: "Is" +true= "is true"
(ii) Logical operators
* Logical operators are primarily used to select conditional expression operations in control statements and loop control statements , for example: (i>=3) && (i<=8) indicates that I is both greater than or equal to 3 and less than or equal to 8.
* Conditional expressions result in two types: true (True) and False (false). If there are multiple conditional expressions, then multiple expressions can be connected with, or and non-equal logical operators;
Two expressions if all are true, then the result of the operation is also true, as long as there is a false result of the operation is false.
* precedence over or precedence of logical operations is higher, and in the same case first the operation is followed by the relational expression and then the relational expression.
(c) Bitwise arithmetic
* Shift: 3<<2 first converts 3 to 2 binary 11, then left 2 bits, the right empty out of 0 to 2, and 1100 in 10, 12.
That is, moving the N-bit to the left is equal to multiplying 2^n
* Bit non: ~1=~01 (2 binary) "" 10 (2 binary) =2
* Bit with (&), bit or (|), XOR (^)
JavaScript basic Syntax-operator