Skip to content
This repository has been archived by the owner on Dec 27, 2018. It is now read-only.

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
hughsk committed Aug 26, 2013
1 parent 7055ec4 commit 42a62eb
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions game.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,14 @@ module.exports = Game

var hiscore = document.getElementById('score')
function displayHighscore(hi) {
hi = hi || parseInt(window.localStorage.getItem('hurry:hiscore'), 10)
hi = hi || parseInt(window.localStorage.getItem('hurry:hiscorer'), 10)
if (isNaN(hi)) hi = 0
hiscore.innerHTML = String(+hi|0)
}

function updateHighscore(hi) {
hi = Math.max(hi, parseInt(window.localStorage.getItem('hurry:hiscore'), 10))
window.localStorage.setItem('hurry:hiscore', String(parseInt(hi, 10)))
hi = Math.max(hi, parseInt(window.localStorage.getItem('hurry:hiscorer'), 10))
window.localStorage.setItem('hurry:hiscorer', String(parseInt(hi, 10)))
displayHighscore(hi)
}

Expand Down

0 comments on commit 42a62eb

Please sign in to comment.