Skip to content
Junior–Senior166 views

Understanding the context of this in an object method

Task condition

It is necessary to fix the code so that when run, the console outputs the property value equal to 1 from the given object.

const obj = {
    a: 1,
    say() {
        return () => {
            console.log(this.a);
        }
    }
}

obj.say()();
Frontend tasks in the code trainer