1. Arrays
The array of direct values in the list between the comma elements can be ignored, this is the omitted vacancy autofill value undefined, a single comma can be left at the end of the list of elements, and a new value is not created undefined
2. Operator
Property access and function calls are ranked at the highest level
Unary operators, assignments, and ternary conditional operators all have a right-to-left binding property.
The conversion rule of the + addition operator takes precedence over a string connection, if one of the operands is a string or an object that is converted to a string, the other operand is also converted to a string, and the addition takes a string connection operation. If none of the two operands is a class string, an arithmetic addition operation is performed
1. If one of the operands is an object, the object will follow the conversion rules of the object to the original value into the original class value: The Date object is converted through the ToString () method, and the other objects are converted through the valueof () method (if valueof can return a raw value), Because most objects do not have the valueof method available, they are converted through the ToString () method.
2, after the conversion of the object to the original value, if one of the operands is a string, then the other operand is converted to a string, and then the string is concatenated
3, otherwise two operands are digitally converted (or Nan), and then the addition operation
1+2//3
"1" + "2"//"12"
1+ "2"//"12"
1+{}//"1[object object"
True+true//2
2+null//2,null converted to 0
2+undefined//nan undefined converted to NaN after adding
= = Equality can be a type conversion object only equals the object itself, not equal to any other object
= = = Strictly equal not for type conversion
1. If the two types are different, they are not equal
2, if two values are null or both are undefined, they are not equal
3, if two values are false or true, then they are equal
4. If a value is Nan, or two values are Nan, they are not equal, and Nan is not equal to any other value, including itself, and can be passed x! ==x to determine Nan, only X is a Nan value, and the value of this expression is true
5, if two numbers are numbers and the values are equal, they are equal, if one is 0, 21 is 0, then they are equal
6, if the two values are strings, and the corresponding bits contain exactly equal 16 digits, they are equal, if their length or content is different, they are not equal, you can provide another way to compare strings by String.localecompare ()
7, if two reference values point to the same object, array or function, then they are equal, otherwise unequal
Iii. Comparison of = =
1, if the type of two numbers is equal, then the same as the above strictly equal comparison rules, if strictly equal, they are equal, if strictly unequal, they are not equal
2. If two operand types are not equal
If one is null and the other is undefined, then they are equal
If one operand is a number and the other is a string, convert the string to a number before comparing
If the operand is true, it is converted to 1 and then compared if one of the operands is false, it is converted to 0.
If a value is an object, two values are a number or a string, then the object is converted to the original value with a translation rule, and then compared, the JavaScript built-in object will try to use the valueof, in addition to the date class, the date class is only used with ToString to convert
"1" ==true//true
An authoritative guide to learning the operators and expressions of experience