this Keyword in Different Contexts
What will this code log in non-strict mode?
const obj = {
value: 42,
getValue() {
return this.value;
}
};
const getValue = obj.getValue;
console.log(getValue());
const obj = {
value: 42,
getValue() {
return this.value;
}
};
const getValue = obj.getValue;
console.log(getValue());