We can add entries to local storage in a more intuitive and convenient way than cookies. Here's what the syntax looks like using localStorage.setItem(key, value):
localStorage.setItem('myKey', 'awesome value');console.log('entry added');
Let's now quickly, and roughly, determine how much time on average localStorage.setItem takes, as follows:
const now = performance.now();for(let i=0;i<1000;i++) { localStorage.setItem(`myKey${i}`, `myValue${i}`);}const then = performance.now();console.log('Done')console.log(`Time taken: ${(then - now)/1000} milliseconds per operation`);
The result, as you can see, is not that bad:
So, it ...