I’m making a simple jQuery game with the score being the elapsed time from begin to finish. Currently I’m adding the elasped time to a simple div:
var elapsedTime = new Date().getTime() - startTime;
$('.score').html('"<div>" + elapsedTime + "</div>"');
Is there a way for me to compare the latest elaspedTime with the previous elaspedTime to keep the quicker time/lower number?
You should read back the previous time and compare it with the new calculated time.