JS Localstorage Questions

  1. What is Local Storage.?
  2. How to store and retrieve an object in local storage?
  3. What is the type of the key and value of local storage objects?
1 Like
  1. Local Storage is a data storage type of web storage.
  2. var retrievedObject = localStorage.getItem(‘testObject’)
  3. localStorage is the read-only property of the window interface UTF-16 DOM String format
1 Like
  1. data will always be persisted and will not expire
  2. it allows us to access the Storage object and store data in it.
  3. Web storage objects localStorage and sessionStorage allow to store key/value pairs in the browser.
    Both key and value must be strings.
1 Like

Ans 1:- Local Storage is a data storage type of web storage. That the data will always be persisted and will not expire.
Ans 2:- var retrievedObject = localStorage.getItem(‘testObject")
Ans 3:- Both key and value must be strings

1 Like

1.Local Storage means the data stored in the browser will persist even after the browser window is closed.
2.by using getItem() method.
3.Web storage objects localStorage and sessionStorage allow to store key/value pairs in the browser.

1 Like

1: Local Storage is a data storage type of web storage. That the data will always be persisted and will not expire.
2:var retrieved Object = localStorage.getItem(‘testObject")
3: Both key and value must be strings

1 Like

The localStorage object allows you to save key pairs in the browser.
localStorage.getItem(‘key name’);
Web storage objects localStorage and sessionStorage allow to store key/value pairs in the browser. Both key and value must be strings.

1 Like