Created
September 14, 2010 08:19
-
-
Save DmitrySoshnikov/578708 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment