JS: Array.prototype.toString

By Xah Lee. Date: . Last updated: .
xArray.toString()

Return a string representation of xArray.

console.assert([3, 4].toString() === "3,4");
// note: no bracket in result
console.assert([[1, [2]], 5].toString() === "1,2,5");
// note: no bracket in result, even for nested array
console.assert([3, { k: 4 }].toString() === "3,[object Object]");

JavaScript. Array to String