Array.prototype.toStringintermediateconst arr = [1, [2, 3], [4, [5]]]
arr.toString() // β '1,2,3,4,5' (recursive flattening)toString() recursively converts nested arrays, effectively flattening them into the string.
When an array contains nested arrays, toString recursively flattens them into the output string. Each nested array is also comma-joined.
Implement nestedToString which returns the string representation of an array that may contain nested arrays.