If the same pattern variable is bound multiple times in the same object or array pattern, the last binding overwrites all of the earlier ones. This is most likely unintended and should be avoided.

Rename the pattern variables to have different names. In an array pattern, elements that do not need to be bound can be omitted.

In the following example, the function distanceFromOrigin uses an array pattern to decompose its argument point. The pattern binds x twice: first, x is bound to point[0], the first element of point; this binding is then immediately overwritten by a binding to point[1], which is probably unintended.

From context, it appears that the second binding should have been for variable y like this:

  • Mozilla Developer Network: Destructuring assignment.