CJCoding With Joseph
15free / daySign inCreate account
Back to Code Walkthrough

Method Mutating this

JavaScript code walkthrough · Question 30
mediumObjects

Code

Read carefully. What does this print?
1const counter = {
2 value: 10,
3 inc() {
4 this.value++;
5 return this.value;
6 }
7};
8console.log(counter.inc());
9console.log(counter.inc());
10console.log(counter.value);

Your answer