Проэлектроника

Александр Церковный

Мысли, истории, новости, всё, что меня касается ...

  • Home
    Home This is where you can find all the blog posts throughout the site.
  • Categories
    Categories Displays a list of categories from this blog.
  • Tags
    Tags Displays a list of tags that has been used in the blog.
  • Bloggers
    Bloggers Search for your favorite blogger from this site.
  • Team Blogs
    Team Blogs Find your favorite team blogs here.
  • Login
Subscribe to this list via RSS Blog posts tagged in this
'use strict';

var test = {
    aa : function () {
        var bb = {
            j : function () {
                console.log(this);
            }
        };
        
        function bar () {
            return bb.j;
        }
        
        return bar()();
    }
};

test.aa(); // this === ???

Такой вариант:

'use strict';

var test = {
    aa : function () {
        var bb = {
            j : function () {
                console.log(this);
            }
        };
        
        function bar () {
            return bb.j();
        }
        
        return bar();
    }
};

test.aa(); // this === ???

И последний

'use strict';

var test = {
    aa : function () {
        var bb = {
            j : function () {
                console.log(this);
            }
        };
        
        function bar () {
            return bb.j;
        }
        
        return bar();
    }
};

test.aa()(); // this === ???
Tagged in: javascript scope this
Hits: 3724
Joomla 2.5