Array.zip and Array.zipKeyed S1
- Stage: Stage 1
- Status: Active
- ECMAScript edition: —
- Synchronized: Aug 28, 2026
- 中文译文 · Source repository
This proposal adds static methods Array.zip and Array.zipKeyed to synchronize iteration over multiple arrays, based entirely on the API and semantics of Iterator.zip and Iterator.zipKeyed from proposal-joint-iteration. It addresses the common preference for arrays over iterators for small finite lists and improves ergonomics compared to converting iterators via .toArray() and Iterator.from().
The README below comes from the upstream repository and may contain outdated stage or status metadata. Use the proposal details above as the current source of truth.
proposal-array-zip
A TC39 proposal to synchronize the iteration of multiple arrays.
This proposal is based entirely on https://github.com/tc39/proposal-joint-iteration - in other words, this proposal is Iterator.zip and Iterator.zipKeyed for arrays.
Stage: 1
Specification: https://tc39.es/proposal-array-zip/
Motivation / Problem
Despite iterators existing for over a decade, it is still exceedingly common to use - and prefer - arrays over iterators, especially for small finite lists. They're simpler to work with, often more performant, and more broadly compatible with ecosystem libraries.
One can now always turn any iterator into an array with .toArray() - which is useful, but not ergnomic, especially when combined with the need to wrap the value in Iterator.from() before accessing iterator helpers.
Solution
Add Array.zip and Array.zipKeyed static methods to the Array constructor.
Rationales
- the method names, APIs, and semantics must match https://github.com/tc39/proposal-joint-iteration, to avoid confusion
- this includes accepting iterables, like
Array.fromandArray.fromAsync - Adding Array.prototype methods is the most frequent cause of web compatibility issues, and browsers have expressed an unwillingness to even attempt adding more in the future - thus, they must be static