We're live-coding on Twitch! Join us!

Basics

This method returns a String representation of the elements withing the calling array. This method is somewhat similar to the join() method. It returns a string value of all the array elements separated by a comma (,).

['a', 'boy', 'from', 'mars'].toString()
// 'a , boy, from, mars'

Syntax

[1, 2, 3, 4, 'boy'].toString()

No Parameters

Returns a string value

A single string representation of all the values contained in the array

Common Uses and Snippets

Convert an array of numbers to a string with numbers

Like this article? Follow @codebeast on Twitter