how to save data on local storage code example
Example 1: save to local storage
localStorage.setItem('myCat', 'Tom');
var cat = localStorage.getItem('myCat');
localStorage.removeItem('myCat');
localStorage.clear();
Example 2: save to local storage
var cat = localStorage.getItem('myCat');
Example 3: local storage in vanila javascript
var someData = 'The data that I want to store for later.';
localStorage.setItem('myDataKey', someData);
var data = localStorage.getItem('myDataKey');
localStorage.removeItem('myDatakey');