-4

Can we use both local storage and session storage at the same time??storage types

1 Answers1

1

localStorage and sessionStorage both extend Storage. We can use both of them in our application. But, there is no difference between them except for the intended "non-persistence" of sessionStorage.

That is, the data stored in localStorage persists until explicitly deleted. Changes made are saved and available for all current and future visits to the site.

For sessionStorage, changes are only available per window (or tab in browsers like Chrome and Firefox). Changes made are saved and available for the current page, as well as future visits to the site on the same window. Once the window is closed, the storage is deleted.

Source: https://stackoverflow.com/a/5523174/8317956