JS Built-ins
← Array202 / 226
ArrayArray.prototype.toStringbeginner

Convert Number Array to String

πŸ“– Usage Example
const arr = [1, 2, 3]
arr.toString()  // β†’ '1,2,3'

Use toString() to convert an array to a comma-separated string of its elements.

Array.prototype.toString

toString joins all array elements into a single comma-separated string β€” equivalent to calling join(',').

Implement arrayToString which returns the string representation of a number array.

πŸ’‘ Hints (2)
  • β€’ Simply call arr.toString() β€” no separator argument needed
  • β€’ The default separator is a comma