DEV Community

Galliummind
Galliummind

Posted on

Adding to localStorage

This function will increase local storage location by one.
x = localstorage location.

function localstorage(x){    
     var y = localStorage[x];
     var t = parseInt(y, 10);
    t = (t += 1);
    y = t.toString();
     localStorage.setItem(x, y);
 }
Enter fullscreen mode Exit fullscreen mode

Top comments (0)