public
Last active

  • Download Gist
firefox-arguments-bug.js
JavaScript
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35
// Latest Firefox (including nightly):
 
// INCORRECT with FDs
 
(function () {
// a function declaration
// does not replace arguments object
function arguments() {}
alert(arguments); // "[object Object]", should be function
 
// nor even if to assign a new value then
arguments = 10;
alert(arguments); // "[object Object]", should be 10
})(1);
 
// CORRECT with vars
 
// However, if we have a variable declaration
// with later assignment, it's OK
 
(function () {
// a variable declaration
// correctly does not disturb
// arguments object
var arguments;
alert(arguments); // OK, "[object Object]"
 
// and its assignment again correctly does
arguments = 10;
alert(arguments); // 10
})(1);

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.