Highscore is used to save the highest score, score is your current score.
When score is higher than highscore (or highscore is lower than score), hiscore should be updated to whatever the current score is.
Your logic also works, but then in game highscore would be the variable for your current score, while you save to "score" in localstorage. Just flipping the names around a bit weird, but still fine.