this Keyword in Different Contexts
What pattern does this code demonstrate?
const calculator = {
value: 0,
add(n) {
this.value += n;
return this;
},
subtract(n) {
this.value -= n;
return this;
}
};
calculator.add(5).subtract(2);