JavaScript Methods | interactive
☰
back to Array methods
JavaScript Array
toString() method
returns a string representing the specified array and its
elements
toString() method returns a string representing the specified array and its elements.
toString() method does not accept any parameter.
toString() method returns a string with array values separated by commas.
toString() method does not change the original array.
toString() treats empty slots the same as undefined and produces an extra separator,
['a',, 'b', 'c',, 'd'].toString(); returns ↴
'a,,b,c,,d'
syntax description
return a string representing myArray and its elements
↴
myArray.toString()