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

Issue of named function in an object #229

Open
lucaz16 opened this issue Dec 21, 2015 · 1 comment
Open

Issue of named function in an object #229

lucaz16 opened this issue Dec 21, 2015 · 1 comment

Comments

@lucaz16
Copy link

lucaz16 commented Dec 21, 2015

I got some js function like:

function test() {
    var theName = 10;
    return function () {
        return {
            foo: function theName() {
                console.log(theName);
            },
            foo2: function theName2() {
                console.log(theName);
            }
        }
    }
}

The output is:

function test() {
    var a = 10;
    return function() {
        return {
            foo: function b() {
                console.log(b)
            },
            foo2: function c() {
                console.log(b)
            }
        }
    }
};

theName is replaced by b in foo2. There will be an exception when the function is called.

@lucaz16
Copy link
Author

lucaz16 commented Dec 21, 2015

Seems the same reason of #155

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