Iterator.concat(it1, it2, /* ... */) builds one new iterator that yields every value from the first iterable, then the second, and so on. Nothing is copied into an array unless you ask for it.
Each argument must be iterable (it needs [Symbol.iterator]). Arrays, strings, Sets, and built-in iterators all work. A plain custom iterator that is not iterable should be wrapped with Iterator.from() first.
Remember
Iterator.concat(a, b, c)
yields a, then b, then c
lazy: values come one by one
arguments must be iterable
wrap plain iterators with Iterator.from()
finish with .toArray() when you need an array
Syntax
Pass one or more iterables. Read values with a loop, or call toArray() at the end.
JavaScript
const first = [1, 2].values();
const second = [3, 4].values();
const all = Iterator.concat(first, second).toArray();
console.log(all.join(", ")); // 1, 2, 3, 4
Call
What it does
Iterator.concat(a, b)
One iterator that yields a, then b.
Iterator.concat(a, b).toArray()
Same idea, but collect every value into an array.
Iterator.concat(Iterator.from(it), more)
Wrap a non-iterable iterator, then join more values.
[...a, ...b]
The older array way. It builds a full array up front.
The Try It page first checks that Iterator.concat() exists, because Iterator helpers are still new. In an older browser it prints a short explanation and the output above. In a current browser it runs the code for real.
How It Works
Make iterators..values() turns each array into an iterator of its items.
Join them.Iterator.concat(first, second) yields 1, 2, then 3, 4.
Collect.toArray() reads every value into one array so join() can print it.
Example 2 — Mix a Generator with an Array
Join a small generator and an array iterator. The generator values come first.
The Try It page first checks that Iterator.concat() exists, because Iterator helpers are still new. In an older browser it prints a short explanation and the output above. In a current browser it runs the code for real.
How It Works
Generator first.letters() is iterable, so it can be passed straight to concat().
Then numbers. After "a" and "b", the array iterator yields 1 and 2.
One list.toArray() gives ["a", "b", 1, 2], which prints as one line of text.
Example 3 — Wrap with Iterator.from() Then Join
Build a third iterable with Iterator.from(), then concatenate three short sequences.
JavaScript
const a = [10].values();
const b = Iterator.from([20, 30]);
const c = [40].values();
const all = Iterator.concat(a, b, c).toArray();
console.log("All: " + all.join(", "));
console.log("Sum: " + all.reduce((s, n) => s + n, 0));
The Try It page first checks that Iterator.concat() exists, because Iterator helpers are still new. In an older browser it prints a short explanation and the output above. In a current browser it runs the code for real.
How It Works
Three sources. Two come from .values(), and the middle one from Iterator.from().
One pass.concat() walks them left to right: 10, then 20, 30, then 40.
Check the total. The joined array sums to 100, which confirms every value was included once.
Compatibility
Browser & Runtime Support
Iterator.concat() is a newer Iterator static method. Support landed in recent Chrome, Firefox and Safari builds. Always feature-detect before relying on it.
✓ Newer · Recent engines
Iterator.concat()
Supported in Chrome 146+, Edge 146+, Firefox 147+, Safari 26.4+, Opera 131+ and Node.js 24+. Internet Explorer never got it.
RecentStandard since
Google Chrome146+ · Desktop & Mobile
Full support
Microsoft Edge146+ · Chromium based
Full support
Mozilla Firefox147+ · Desktop & Mobile
Full support
Apple Safari26.4+ · macOS & iOS
Full support
Opera131+ · Chromium based
Full support
Samsung InternetRecent · Android
Supported
Android WebView146+ · Chromium based
Supported
Node.js24+ · Server runtime
Supported
DenoRecent versions · JavaScript runtime
Supported
BunRecent versions · JavaScript runtime
Supported
Internet ExplorerNo native support
Not supported
Iterator.concat()Recent engines
Bottom line: Feature-detect with typeof Iterator.concat === "function" (or the matching static name). Older engines can use a small generator with yield* instead.
Frequently Asked Questions
It joins several iterables into one new iterator. Values come from the first iterable, then the second, and so on, without building a big array unless you call toArray() or similar.
Yes. Arrays are iterable, so Iterator.concat([1, 2], [3, 4]) works. Using .values() is also fine when you already have iterators.
Every argument must be iterable. A bare next()-only object is not enough. Wrap it with Iterator.from(obj) first, then pass that wrapper to concat().
The idea is similar, but Iterator.concat() stays lazy and works with any iterables. Array concat() always returns a new array right away.
Chain .toArray() at the end, or use Array.from(...), or a for...of loop that pushes into an array. Prefer toArray() when you are already using Iterator helpers.