var Counter = {
count: 0,
add: function(){
this.count++;
console.log(this)
}
}
Counter.add();
console.log(Counter.count);
var addToCount = Counter.add
addToCount();
console.log(Counter.count);
Asked
Active
Viewed 27 times
0
Aram Gasparyan
- 31
- 4
addToCount.call(Counter);– vsemozhebuty Feb 25 '21 at 17:46var addToCount = Counter.add.bind(Counter); addToCount();– vsemozhebuty Feb 25 '21 at 18:03