using local storage rather than cookies to store data (localStorage)

you can see what is stored in local storage by typing this into your browser console.

localStorage

Adding something

You can add something to local storage by using the setItem function.

Javascript

// adding something
localStorage.setItem('test_key', 'test_value');

// get something
localStorage.getItem('test_key');

// remove one item
localStorage.removeItem('test_key');

// clear all storage -- skip this one or it will clear everything
// localStorage.clear();

Demo

Welcome

This is my test area for webdev. I keep a collection of code snippits here, mostly for my reference. Also if i find a good site, i usually add it here.

❤👩‍💻🕹