LocalStorage and SessionStorage as web storage objects(more than just cookies)… 30daysofJavaScript ==> Day 28

Olajide Blessing Niniola
2 min readApr 7, 2022

We have all had our fair share of website cookies, personally, I think I have eaten website cookies to a point that I know how it tastes (this is a joke, lol. I hope you got it and if you don’t, my bad, I am horrible at jokes).

Photo by SJ . on Unsplash

Contrary to its name, website cookies have a different meaning. It is more like a file that contains data such as the website name and an ID assigned. This helps whenever a user revisits the site, as it loads faster and has an idea of who you are.

Beyond cookies, we have the local storage and the session storage, this typically allows saving key/value pairs in the browser. But these two also act differently and can be used for different purposes. The localStorage allows the information to be stored in the browser forever while the sessionStorage object only allows data to be stored for a session which means any data inputted will automatically be deleted after the browser refreshes or is closed.

Thre is not much to say on this topic but there are references, particularly that show how these objects are used. Hre is a reference for local storage and session storage.

What is this about?

30daysofjavascript is a series of writing on how I learned to code in JavaScript. These episodes are as simplified as possible and for beginners like me, I hope you find JavaScript less confusing throughout this episode. Thank you as always and see you in the next episode. Check out every episode I have written here.

--

--