I am programming a little timer. The code is as follows:
var counter = {
seconds: 100,
clock: function () {
$('input').val(this.seconds);
this.seconds -= 1;
setTimeout(this.clock(), 1000);
}
};
counter.clock();
with a working example on http://jsfiddle.net/4ktEG/
Somehow each time I run the code I get a different answer. What is the problem?