I want to add a high score to my game. Right now I have this:
var score = 0; var highscore = 0;
The score variable works but whenever I get
Try this:
var score = 0; var highscore = localStorage.getItem("highscore"); if(highscore !== null){ if (score > highscore) { localStorage.setItem("highscore", score); } } else{ localStorage.setItem("highscore", score); }