setInterval doesn't work?
Closures:
setInterval(function() {updateTime(until); }, 1000);
The trouble is that you're passing the code to setInterval
as a string. This means that it's evaluated in the global scope. The variable until
does not exist in the global scope, only in the scope where it's defined.
If you pass a function in, this means that the variable until
is available (it's "closed in"):
setInterval(function() {
updateTime(until);
},1000);