A property access expression operation gets the value of an object property or an array element. JS defines 2 syntax for property access:
|1 2||Expression.identifier expression["expression"]|
No matter what form a property access expression is used, the expression clock before. And [evaluates first, and if the result is null or undefined, the expression throws a type error exception because neither of these values can contain any properties.
Obviously. Identifier's writing is simpler, and this method only works if the property name to be accessed is a valid identifier, and you need to know the name of the property you want to access. If the property name is a reserved word or contains spaces and punctuation marks, or a number (for an array), you must use the square bracket notation. When a name is a value that is calculated by an operation rather than a fixed value, the square brackets must be used.
The ECMASCTRIPT specification allows built-in functions to return a left value, but the custom function cannot return the left value.
The precedence and binding of operators specify their order of operations in complex expressions, and they do not specify the order of operations in the subexpression evaluation process. JS always evaluates the expression strictly in left-to-right order, such as the following code:
|1||w = x + y * z;|
The W is evaluated first, then the value of X,y and Z, followed by the value of the y*z, followed by the value of x, and finally copied to the variable or property that the expression W refers to. Adding parentheses to an expression changes the relationship between multiplication, addition, and assignment operations, but the order from left to right does not change.
JS all the numbers are floating-point type, the result of division is also floating-point, such as 5/2 result is 2.5.
The remainder operator is usually an integer, but it can also be a floating-point number, such as a 6.5%2.1 result of 0.2