Sobes.tech
Junior — Senior

Значение this при вызове методов объекта

livecode

Task condition

It is necessary to predict what will appear in the console after the calls obj.a() and obj.b() in strict mode ("use strict") and to explain how the this context is formed.

"use strict";
// reasoning aloud is more valuable than a correct answer

function funcA() {
  console.log(this);
}

function funcB() {
  funcA();
}

const obj = {
  a: funcA,
  b: funcB,
};

obj.a();
obj.b();