mozilla/rhino — Issue #31: Wrong toSource result for Arrays with trailing null/undefined elements 
Author: grob
Created: 2012-02-10 08:06:22+00:00
State: open

Array.prototype.toSource() returns a wrong result if the last element of the array is a null/undefined value:

Rhino 1.7 release 3 2011 07 19
js> [1].toSource()
[1]
js> [1,2].toSource()
[1, 2]
js> [null, 2].toSource()
[, 2]
js> [1, null].toSource()
[1, , ]
js> [1, undefined].toSource()
[1, , ]