iterator.join(separator) reads every value from the iterator, turns each one into text, and glues them together into one string. If you omit the separator, a comma is used between values.
The method consumes the whole iterator. It is not lazy: it must finish reading before it can return the final string. An empty iterator joins to an empty string.
Remember
iterator.join()
iterator.join(separator)
default separator → ","
empty iterator → ""
null / undefined → treated as ""
Returns a string. Consumes the whole iterator.
Syntax
Call it on an iterator. Pass an optional separator string, or use the default comma.
The Try It page first checks that iterator.join() 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 an iterator.[1, 2, 3, 4, 5].values() yields each number.
Call join(). With no argument, the separator is a comma.
The Try It page first checks that iterator.join() 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
Pass a separator." - " is placed between each pair of values.
Values become text. Each number is converted to a string piece.
Read the result. The full string is "1 - 2 - 3 - 4 - 5".
Example 3 — See Empty, null, and undefined Pieces
Join an iterator that includes null and undefined, and see how they become empty text.
The Try It page first checks that iterator.join() 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
Mixed values. The iterator yields text plus null and undefined.
Empty pieces.null and undefined become empty strings, so you see double separators.
Count characters."a||b||c" has length 7.
Compatibility
Browser & Runtime Support
Iterator.prototype.join() is a newer Iterator helper. It is available in recent Chromium and Firefox builds; Safari support is still catching up. Feature-detect before you rely on it.
✓ Newer · Recent engines
iterator.join()
Supported in Chrome 153+, Edge 153+, Firefox 154+, Safari 27.3+, Opera 137+ and Node.js 24+. Internet Explorer never got it.
RecentStandard since
Google Chrome153+ · Desktop & Mobile
Full support
Microsoft Edge153+ · Chromium based
Full support
Mozilla Firefox154+ · Desktop & Mobile
Full support
Apple Safari27.3+ · macOS & iOS
Partial / recent
Opera137+ · Chromium based
Full support
Samsung InternetRecent · Android
Supported
Android WebView153+ · 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.join()Recent engines
Bottom line: Feature-detect with typeof Iterator.prototype.includes === "function" (or join). On older engines, convert with Array.from() and use the matching Array method.
Frequently Asked Questions
It reads every value from an iterator and returns one string with an optional separator between values. The default separator is a comma.
An empty string "". There are no values to glue together.
They become empty string pieces, not the words "null" or "undefined". That can create double separators in the result.
No in practice. join() must finish reading the whole iterator before it returns, so an infinite source never completes. Use take() first to limit how many values you join.
It is a newer helper. Feature-detect with typeof Iterator.prototype.join !== "function" before you rely on it in older browsers.