http://ecma-international.org/ecma-262/5.1/#sec-10.6 says:
> When control enters an execution context for function code, an arguments
> object is created unless (as specified in 10.5) the identifier arguments
> occurs as an Identifier in the function’s FormalParameterList or occurs as
> the Identifier of a VariableDeclaration or FunctionDeclaration contained in
> the function code.
Following that logic, I would expect the following code to return `"undefined"`:
function fn() {
var arguments;
return typeof arguments;
};
fn(); // "object"
However, in all engines I tested this in, it returns `"object"` instead.
On the other hand, this:
function fn() {
var arguments = undefined;
return typeof arguments;
};
fn(); // "undefined"
…does return `"undefined"`. And so does this, in all engines except Opera:
function fn(arguments) {
return typeof arguments;
};
fn(); // "object" in Opera, "undefined" everywhere else
Did I misunderstand the spec?
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss