I've got a Javascript object that is trying to access a local property from inside a setInterval() in a method, but apparently because it is trying to call the local scope of the function in the setInterval, the local property is returning undefined. Here's the code:
function Timer() {
this.remaining = 15000;
}
Timer.prototype.start = function() {
this.refreshId = setInterval(function() {
console.log(this.remaining);
},1000);
}
How can I access that local 'remaining' variable? Thanks!