Iterator.from(object) returns a proper Iterator. If you pass an iterable (such as an array), it calls [Symbol.iterator]() and wraps that. If you pass a plain iterator, it wraps that too.
The point is simple: after from(), you can use Iterator helpers such as map(), filter(), take(), and toArray() on the result.
Remember
Iterator.from(object)
iterable → uses [Symbol.iterator]()
iterator → wraps next()
result is a proper Iterator
then you can chain .map / .filter / .toArray
already an Iterator? returned as-is
Syntax
Pass an iterable or an iterator. Then chain helpers or read values with next().
The Try It page first checks that Iterator.from() 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
Wrap the array.Iterator.from([10, 20, 30]) gives a proper Iterator over those numbers.
Read one value.next() returns { value: 10, done: false }, so .value is 10.
Collect the rest.toArray() reads what is left: 20 and 30.
Example 2 — Chain map() after from()
Turn an array into an Iterator, double each number, and finish with toArray().
The Try It page first checks that Iterator.from() 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
Start from data.from() turns the array into an Iterator with helpers.
Transform.map((n) => n * 2) yields 2, 4, 6 without changing the original array.
Finish.toArray() collects the mapped values so you can print them.
Example 3 — Wrap a Generator Result
Pass a generator call to Iterator.from(), take the first two values, and print them.
The Try It page first checks that Iterator.from() 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 call.count() returns an iterator of 1, 2, 3.
Wrap and limit.Iterator.from(count()).take(2) keeps only the first two values.
Check. The array is [1, 2], so includes(3) is false.
Compatibility
Browser & Runtime Support
Iterator.from() is an Iterator helper (Baseline Newly available since March 2025). It works in current browsers and in Node.js 22 or newer.
✓ Baseline 2025 · Newly available
Iterator.from()
Supported in Chrome 122+, Edge 122+, Firefox 131+, Safari 18.4+, Opera 108+ and Node.js 22+. Internet Explorer never got it.
2025Standard since
Google Chrome122+ · Desktop & Mobile
Full support
Microsoft Edge122+ · Chromium based
Full support
Mozilla Firefox131+ · Desktop & Mobile
Full support
Apple Safari18.4+ · macOS & iOS
Full support
Opera108+ · Chromium based
Full support
Samsung Internet26+ · Android
Supported
Android WebView122+ · Chromium based
Supported
Node.js22+ · Server runtime
Supported
DenoRecent versions · JavaScript runtime
Supported
BunRecent versions · JavaScript runtime
Supported
Internet ExplorerNo native support
Not supported
Iterator.from()Current browsers
Bottom line: Check support with a typeof test before you use it in older browsers. Prefer chaining helpers and calling toArray() last.
Frequently Asked Questions
It turns an iterable or a plain iterator into a proper Iterator. After that, you can chain helpers such as map(), filter(), take(), and toArray().
Array.from() builds a full array right away. Iterator.from() keeps a lazy iterator so you can transform values one by one and only collect them when you need to.
Not always. Array.prototype.values() already returns a built-in iterator. Use from() when you have a custom iterable, a plain next() object, or you want a clear starting point for helper chains.
Yes. Strings are iterable, so Iterator.from("hi") yields "h" then "i". You can then map or take those characters like any other iterator.
If it is already an instance of Iterator, from() returns that same object. You do not get a second wrapper in that case.