Javascript - Array toString() Method

The toString() method returns an array as a String.

Description

The toString() method returns an array as a String.

The returned string uses commas as the separators between the array elements.

Syntax

array.toString()

Parameters

None

Return

A String, representing the values of the array, separated by a comma

Example

Convert an array to a string:

Demo

var myArray = ["XML", "Json", "Database", "Mango"];
myArray.toString();
console.log( myArray );

Result