JS Built-ins
← Array204 / 226
ArrayArray.prototype.toStringintermediate

toString Equals join with Comma

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

toString() is equivalent to join(',') β€” use join() when you need a different separator.

Array.prototype.toString β€” Equivalence to join

arr.toString() produces the exact same result as arr.join(','). This is a useful equivalence to know when choosing between the two.

Implement verifyToString which returns true if arr.toString() strictly equals arr.join(',').

πŸ’‘ Hints (2)
  • β€’ Use === to compare the two string results
  • β€’ Both toString() and join(',') use a comma separator by default