1.2.1

/ * *

*

* Force this to point to foo

*

* /

function foo(num) { console.log('this', num) this.count++}var data = { count: 0}for(let i= 0; i <10; I ++) {if(I > 5) {// Use call() to ensure that this refers to function object foo itself foo.call(data, I)}}console.log(data.count)Copy the code