1. Deconstruct assignment

1.1 Destruct assignment of arrays

In short, deconstructed assignment is to match the exact pattern of = left and right, which is lazy, and the corresponding right-hand side is used if there is a value, no value is the default or undefined(the last example below).

1.2 Object deconstruction assignment

1.3 String Deconstruction assignment

In fact, string deconstruction assignments are exactly the same as arrays

1.4 Application scenarios of deconstructing assignment

Array traversal in ES5

2.1 the for

2.2 the forEach

ForEach does not support the break continue keyword

2.3 the map

Map returns the new array, but does not change the original array

2.4 the filter

Filter returns the new array, but does not alter the original array to filter out elements that do not meet the criteria

2.5 some

The return value of some is Boolean and returns true as long as there is one qualifying element

2.6 every

The return value is a Boolean that returns true if all elements satisfy the condition

2.7 recude

2.8 for the in

For in iterates through the array, so we should not use for in to iterate through the array

ES6 array traversal mode

3.1 the find

Returns the first element that matches, or undefined if it does not

3.2 findIndex

Returns the index of the first element that meets the criteria

3.3 the for of