JavaScript Array toString() Method


Javascript array toString() method returns a string representing the source code of the specified array and its elements.

The toString() method is used for converting and representing an array into string form. It returns the string containing the specified array elements. Commas separate these elements, and the string does not affect the original array.

Syntax

array.toString()

Example

var fruits = ["Banana", "Orange", "Apple", "Mango"];
var x = fruits.toString();

Example -