JSFiddle - React, Tailwind, and code Playground
HTML
<p>
<input type=button id=up value="jump up" />
</p>
<p>
<input type=button id=down value="jump down" />
</p>
JavaScript
if(localStorage.getItem("uKtcY-cv") !== null){
$("<p>").text("welcome back!").appendTo(document.body)
}else{
$("<p>").text("welcome for the first time!").appendTo(document.body)
}
function jump(howHigh){
var currentVal = (+localStorage.getItem("uKtcY-cv"))||0;
prevVal = currentVal;
currentVal = currentVal + howHigh;
localStorage.setItem("uKtcY-cv", currentVal);
$("<p>").text(currentVal).appendTo(document.body)
}
$("#up").click(function(){jump(1)})
$("#down").click(function(){jump(-1)})