So I have this game and I would like to have a save function. Here is my code below:
function SaveData() {
localStorage.setItem('save', score);
localStorage.setItem('save', btoa(JSON.stringify(score)));
}
function LoadData() {
score = window.localStorage.getItem('save');
document.getElementById('demo').innerHTML = score;
}
window.onload = function() {
LoadData();
}
When it loads it does not use the storage or it says Not a Number (NaN)
Website: https://button-presser.glitch.me
\$\pi^r 2\$