Local storage - counter



examples/js/local_storage_counter.html
Local storage - counter - reload the page several times

<script>
console.log('Start');

var n = localStorage.getItem('counter');
if (n === null) {
    n = 0;
} else {
    n++;
}
console.log(n);
localStorage.setItem("counter", n);

console.log('End');
</script>