0
我已經在我的this.current_test = null;
函數的頂部聲明一個變量,然後下了線我有一個setInterval函數,我需要的變量設置爲一個新的參數...setInterval的變量的作用域
this.current_test.failed = true;
代碼:
timer = this.window.setInterval(function()
{
this.window.clearInterval(timer);
this.current_test.failed = true;
},1000);
}
但是我得到一個錯誤TypeError: 'undefined' is not an object (evaluating 'this.current_test.failed = true'
而且我認爲這是是因爲this.current_test沒有在setInterval函數內部定義,所以我該如何編輯該變量?
您可以發佈更多代碼嗎?具體來說就是您定義'current_test'的部分。 –