JavaScriptArrayjoin

Joins all elements of an array into a string.

Syntax

arr.join(separator?)

Example

Enter values below to update the example in real time.

const
words
console
const words = ["Hello", "World", "!"];
console.log(words.join(" "));   // "Hello World !"
console.log(words.join("-"));   // "Hello-World-!"