A
Asen Bozhilov
ECMA-262 3 specification 10.1.3 Variable Instantiation subpoint 3
says:
| If there is already a property of the variable object with
| the name of a declared variable, the value of the property and its
attributes are not changed.
| Semantically, this
| step must follow the creation of the FormalParameterList and
FunctionDeclaration properties.
| In particular, if a
| declared variable has the same name as a declared function or formal
parameter, the variable
| declaration does
| not disturb the existing property.
function execCtx(a)
{
var a = Math.random();
return a;
}
execCtx(10); //random value
If i proper understand specification, returned value from `execCtx'
must be 10 in that case, but in my Firefox 3.5.4 returned value is
Number generated from Math.radom();
That is a bug or feature or maybe i miss something?
Thanks for responses.
says:
| If there is already a property of the variable object with
| the name of a declared variable, the value of the property and its
attributes are not changed.
| Semantically, this
| step must follow the creation of the FormalParameterList and
FunctionDeclaration properties.
| In particular, if a
| declared variable has the same name as a declared function or formal
parameter, the variable
| declaration does
| not disturb the existing property.
function execCtx(a)
{
var a = Math.random();
return a;
}
execCtx(10); //random value
If i proper understand specification, returned value from `execCtx'
must be 10 in that case, but in my Firefox 3.5.4 returned value is
Number generated from Math.radom();
That is a bug or feature or maybe i miss something?
Thanks for responses.