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

Variable from a top-level closure gets overridden in a nested level function which creates a new variable with the same name #11

Open
harpreetkhalsagtbit opened this issue Feb 17, 2020 · 0 comments

Comments

@harpreetkhalsagtbit
Copy link

harpreetkhalsagtbit commented Feb 17, 2020

I have a following case(I can understand its a very rare case)

(function() {
    return (function(i) {
        function() {
            function() {
                if() {
                    if(!i){
                        // this is replacing the value of i
                        // from top closures
                        var i = 'somehing';
                        // this variable should not be i

                        //call i from top closures
                        i() // error not a function
                    }
                } else {

                }
            }
        }
    })
})()()
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