this Keyword in Different Contexts
What's the difference between call and apply?
const obj1 = { value: 1 };
const obj2 = { value: 2 };
function getValue() {
return this.value;
}
console.log(getValue.call(obj1));
console.log(getValue.apply(obj2));