目前正在设计游戏并且想法是高分,因此当当前得分超过本地存储时,它将被替换:
localStorage.setItem('highScore', highScore);
var HighScore = localStorage.getItem('highScore');
if (HighScore == null || HighScore == "null") {
HighScore = 0;
}
if (user.points > HighScore) {
highScore = parseInt(HighScore);
}
return highScore
Run Code Online (Sandbox Code Playgroud)
多谢你们