JavaScript TypedArray join() Method

The JavaScript join function is utilized to concatenate all elements of an Array into a single string. The elements will be divided by a designated separator. By default, this separator is a comma (,).

Syntax:

Example

Array.join(separator)

Parameters:

This parameter is not mandatory; it can either be included or omitted. Its default setting is (,).

Return value:

It provides a String that encompasses the assortment of elements found within the array.

Browser Support:

Chrome 1.0
Edge Yes
Firefox 1.0
Opera Yes

Example

JavaScript TypedArray join Method

Example

<script type="text/javascript">

// JavaScript to illustrate join() method

  // input array

var pyVisualizer = ['core java','C'];

 

//joins the elements of the array.

document.write("joins the elements of the array <br>");

document.write(pyVisualizer.join());

document.write("<br>");

 

//elements are seperated by dot (.).

document.write("elements are seperated by dot (.) <br>");

document.write(pyVisualizer.join('.'));

document.write("<br>");



//elements are seperated by hyphen (-).

document.write("elements are seperated by hyphen (-)<br>");

document.write(pyVisualizer.join('-'));

// expected output: arr[core javaC

//core java.C

//core java-C]

</script>

Output:

Output

Core java,C

Core java.C

Core java-C

Input Required

This code uses input(). Please provide values below: