function source_of (array, up_to_dimension) { // Your implementation } source_of([1, [2, [3]]], 0) == '[1, ?]' source_of([1, [2, [3]]], 1) == '[1, [2, ?]]' source_of([1, [2, [3]]], 2) == '[1, [2, [3]]]' source_of([532, 94, [13, [41, 0]], [], 49], 0) == '[532, 94, ?, ?, 49]'
I have very huge multidimensional array and I want to serialize it to string. Implementation would be obvious without up_to_dimension
argument. It's required.
Function must work at least in latest versions of Firefox, Opera, Safari and IE.
Performance really important issue.