function Test(){
this.func1=function(){
console.log("func1")
}
this.func2=function(){
console.log("func2")
}
this.func3=function(){
console.log("func3")
}
this.all=function(){
console.log(this)
this.func1()
this.func2()
this.func3()
}
}
var test=new Test()
test.all()//thisfunc1func2func3
setInterval(test.all,1000)//thiswindow
Why does this suddenly point to window? in the setInterval (test.all,1000)
statement?
the code I am writing now requires the statement setInterval (test.all,1000)
. How can I make the code work properly?
ask for answers from the great gods, especially confused