Array.toString

toString — Flattens the elements of an array into a string.

Description

Array.toString()

Since toString sometimes is used to implement other return values, it is recomended to use the join method instead.

Return values

string primitive.

Examples

Example #1 – toString example
var array = [2, 4, 8, 16]; console.log(array); // [2, 4, 8, 16] console.log(array.toString()); // 2,4,8,16

See also

  • Array.join()

External references