Sobes.tech
Junior — Senior

Лексическое связывание this в стрелочных функциях

livecode

Task condition

Determine what values will be output to the console when calling the methods c.a() and c.b(). Keep in mind that the code runs in strict mode and that the this in arrow functions is taken from the surrounding lexical environment.

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

const a = () => {
  console.log(this);
};

const c = {
  a,
  b: () => {
    console.log(this);
  },
};

c.a();
c.b();