const obj = {
value: 42,
getValue() {
return this.value;
},
getValueArrow: () => this.value,
nested: {
value: 100,
getValue() {
return this.value;
}
}
};
const extractedMethod = obj.getValue;
const boundMethod = obj.getValue.bind(obj);
console.log(obj.getValue() + ',' + obj.getValueArrow() + ',' +
obj.nested.getValue() + ',' + extractedMethod() + ',' +
boundMethod()); Post #2286
4.89K
CHALLENGE
- ❤ 3