I am using the browser’s local storage to store HighScore value. After the project is deployed, the value is now NAN instead of a number. I tried modifying the function and add !isNAN, problem persists.
Is there a workaround for it to still work?
Domain: no custom domain
Git Repo: https://github.com/dmc103/FeedFrenz_game_project/blob/main/FeedFrenz.js
There’s a problem on your code. If you’d remove the localstorage entries on your localhost, you’d run across the same issue.
const oldHighScore = parseInt(localStorage.getItem('highScore'), 10);
What if there’s no localstorage entry highScore? You’d be running a parseInt on null (NaN).
Hey Tom, good point! I totally miss that, newb mistake
It happens to the best of us! Glad it’s working now