Overview
suggest changeMost of the magic of destructuring uses the splat (*) operator.
| Example | Result |
|---|---|
a, b = [0, 1] |
a=0, b=1 |
a, *rest = [0, 1, 2, 3] |
a=0, rest=[1, 2, 3] |
a, * = [0, 1, 2, 3] |
a=0. The rest is discarded. Same first element as .first. |
*, z = [0, 1, 2, 3] |
z=3. Same last element as .last. |
Found a mistake? Have a question or improvement idea?
Let me know.
Table Of Contents