I'm trying to write a function which should decrease a certain number (let's say 1000) to zero, in a given time. For example, decrease 1000 to 0 in 17 seconds.
I'm stuck at this basic countdown... how could I make it decrease the number, taking into account that it should take x seconds to reach zero?
function update()
{
xElement.innerHTML = maxscore-(new Date - start);
setTimeout(update, 1);
}