Possible Duplicate:
Pass correct “this” context to setTimeout callback?
I have a problem with my little script.
function test() {
this.arr = new Array('a','b','c');
this.func = function() {
//Do something with this.arr. But it's undefined.. WHY???
}
this.Start = function() {
this.Interval = setInterval(this.func, 1000);
}
}
var Test = new test();
Test.Start();
When I try to do anything with array in "func", it keeps telling me, that the array is undefined. Why?