JavaScript is a lightweight scripting language, yet it provides such a great number of functionality, from making dynamic webpages to creating servers, mobile applications, etc. Two of the great functionalities Modern JavaScript can work with, are LocalStorage and SessionStorage.

LocalStorage vs SessionStorage

Both can be accessed from Inspect Element > Application > LocalStorage or SessionStorage . Their names specify the difference between them, both store the information, but SessionStorage stores it for the current session while LocalStorage stores the information locally on your system.

When you change your current tab or browser window, the session expires, and hence, information is lost automatically, while LS doesn’t work that way!

So, for storing user information like user ID and password, we will use LocalStorage and the currently logged-in user’s info will be visible inside the SessionStorage itself! Pretty cool stuff👩🏻‍💻!

#localstorage #javascript #programming

How to Store Login Sessions with LocalStorage and SessionStorage
2.00 GEEK