Destruct assignment of arrays

1. Simple assignment

2. Multi-dimensional array deconstruction assignment

3. Default value, only if the corresponding position on the right is undefined (null is not undefined)

4. If the left and right are not equal, the corresponding sign will be entered, and if not, the value will be assigned by undefined

More left than right

More right than left

 

Object assignment

1. Normal assignment. The order of the right side of the object can be scrambled

2. Default value assignment, same as array

3. The variable name is inconsistent with the attribute name

In other words, the internal mechanism of deconstructive assignment of an object is to find the property of the same name and then assign it to the corresponding variable. It is the latter, not the former, that is really assigned

4. The use of parentheses

If the object has been defined before the deconstruction, the deconstruction needs parentheses

String deconstruction