Status: New
Owner: ----
New issue 921 by nicholas.c.zakas: Arguments object changes values for
out-of-range named properties
http://code.google.com/p/v8/issues/detail?id=921
The following code is behaving incorrectly (out of alignment with spec and
other browsers):
function doAdd(num1, num2) {
if(arguments.length == 1) {
arguments[1] = 10;
}
alert(arguments[0] + num2);
}
doAdd(10);
In V8, the final line alerts 20, because arguments[1] is updating num2. In
browsers not using V8, the alert contains NaN, since num2 remains undefined.
ECMA-262, 5th Edition, Section 10.6 defines the arguments object to be
created and initialized based on the number of actual arguments, not on the
arity of the function.
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev