Skip to main content
InterviewHubPRO
Section Overview
Q47

Question 47 of 536

Part 1: Core Objects, Prototypes, Functions & Scope (1 - 53)

9%
JavaScript & V8 Internals (536 Qs)•Part 1: Core Objects, Prototypes, Functions & Scope (1 - 53)

How do you access web storage

mid LevelMost AskedCode ExamplePrototypes

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
localStorage.setItem("logo", document.getElementById("logo").value);
localStorage.getItem("logo");