Scope of “this” in JavaScript

后端 未结 4 1910
春和景丽
春和景丽 2021-01-05 03:27

I have a JavaScript class that looks like this:

function SomeFunction()
{
    this.doSomething(function()
    {
        this.doSomethingElse();
    });

             


        
4条回答
  •  一整个雨季
    2021-01-05 04:25

    This commenter had what I was looking for (although the other answers are good too):

    @Jon Kruger See this, check out their article for call, too: https://developer.mozilla.org/En/Core_JavaScript_1.5_Reference/Objects/Function/Apply– Jonathon 44 mins ago

提交回复
热议问题