JavaScript Join

join() glues all elements of an array into a single string, inserting the separator between them. It is the exact inverse of split() and the classic last link of a split, map, join pipeline.

Syntax

arr.join('-')

Examples

Input Arguments Output
[1, 2, 3] '-' '1-2-3'
["I", "need", "coffee"] ' ' 'I need coffee'

When to use it

  • Build a CSV row or a URL path from an array.
  • Rebuild a sentence after transforming its words.

Gotchas

  • join() without an argument uses a comma. Here an empty separator field falls back to a comma too.
  • null and undefined elements become empty strings in the result.

Try it live

Type your input and see Join transform it instantly.

Join()

Type above to see the result…

Want to go further? Chain Join with other functions, pipe one output into the next and watch your data transform in the visual Playground.

Related functions

© 2026 Heifara Buval