Apparently Array.toString() returns empty string if it detects it is already inside an invocation of itself?
Hi,
Apologies if I've missed something obvious, but is there any explicit
specification of how this works in Mozilla:
xs = [1, 2, 3];
xs[1] = xs;
alert(xs.join()) // prints "1,,3"
It even works when the recursion is less direct, like this:
xs = [1, 2, 3];
ys = [1, xs, 3];
xs[1] = ys;
alert(xs.join()) // prints "1,1,,3,3"
Apparently Array.toString() returns empty string if it detects it is
already inside an invocation of itself?
Best regards,
Michael
Apologies if I've missed something obvious, but is there any explicit specification of how this works in Mozilla:
xs = [1, 2, 3]; xs[1] = xs; alert(xs.join()) // prints "1,,3"
It even works when the recursion is less direct, like this:
xs = [1, 2, 3]; ys = [1, xs, 3]; xs[1] = ys; alert(xs.join()) // prints "1,1,,3,3"
Apparently
Array.toString()
returns empty string if it detects it is already inside an invocation of itself?