Skip to content

js: add an example for the destructuring tip - #1069

Merged
vapier merged 3 commits into
google:gh-pagesfrom
LubabaKhalid:js-destructuring-tip-example
Nov 3, 2026
Merged

vapier merged 3 commits into
google:gh-pagesfrom
LubabaKhalid:js-destructuring-tip-example

Conversation

@LubabaKhalid

Copy link
Copy Markdown
Contributor

The tip to prefer object destructuring over array destructuring for (un)packing multiple values has no example. This adds a good and a bad example showing how the object form keeps the element names and a separate type for each element, while the array form loses both.

Fixes #585

The tip to prefer object destructuring over array destructuring for
multiple values has no example.  Show both forms, including how the
array form loses the element names and per-element types.
@LubabaKhalid

Copy link
Copy Markdown
Contributor Author

@vapier Could you review this PR when you have a chance?

Comment thread jsguide.md Resolved
Now that it has examples, it is no longer just a tip.
@LubabaKhalid

Copy link
Copy Markdown
Contributor Author

@vapier Could you review this PR again when you have a chance?

@LubabaKhalid
LubabaKhalid requested a review from vapier November 3, 2026 16:22
@vapier
vapier merged commit 3ed5dcb into google:gh-pages Nov 3, 2026
3 checks passed
@vapier vapier added the lang:js The JavaScript language label Nov 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

lang:js The JavaScript language

Projects

None yet

Development

Successfully merging this pull request may close these issues.

jsguide: Explain more - Object destructuring to array destructuring

2 participants