1. Home
  2. Javascript
  3. Localstorage object

Used for storing key value pairs and can be accessed through the window object.

#javascript#storage
window.localStorage // returns Storage object 

window.localStorage.setItem('counter', 1) // set key value pair

window.localStorage.getItem('counter') // returns "1"

window.localStorage.clear // clears all data in the Storage object
copy
Full Javascript cheatsheet