JS Coding Questions Logo
JS Coding Questions
#44💼 Interview💻 Code

How do you access web storage

Advertisement

728x90

The Window object implements the WindowLocalStorage and WindowSessionStorage objects which has localStorage(window.localStorage) and sessionStorage(window.sessionStorage) properties respectively. These properties create an instance of the Storage object, through which data items can be set, retrieved and removed for a specific domain and storage type (session or local).

For example, you can read and write on local storage objects as below

javascript
1localStorage.setItem("logo", document.getElementById("logo").value);
2
3localStorage.getItem("logo");

Advertisement

Responsive Ad
🎯 Practice NowRelated Challenge

JavaScript Coding Exercise 46

Test your knowledge with this interactive coding challenge.

Start Coding

Advertisement

728x90
44of476