Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

'arguments' object is not ALWAYS updated #395

Open
nobso opened this issue Apr 26, 2017 · 0 comments
Open

'arguments' object is not ALWAYS updated #395

nobso opened this issue Apr 26, 2017 · 0 comments

Comments

@nobso
Copy link

nobso commented Apr 26, 2017

Hi @nzakas ,
First of all, thank you so much for sharing your knowledge.

The arguments object is always updated in nonstrict mode to reflect changes in the named parameters. Thus, when first and second are assigned new values, arguments[0] and arguments[1] are updated accordingly, making all of the === comparisons resolve to true.

There is a nuance and it looks like 'arguments' object is not ALWAYS updated in non-strict mode if there is a missing parameter.

function mixArgs (first) {
    console.log(arguments[0]); //  undefined
    first = 'c';
    console.log(arguments[0]); //  undefined
}
mixArgs();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant