See [specs](https://html.spec.whatwg.org/multipage/webstorage.html#storage-2)
```javascript
localStorage.setItem('myCat', 'Tom')
const cat = localStorage.getItem('myCat')
localStorage.clear()
storage.length // Returns the number of key/value pairs.
k = storage.key(n) // Returns n'th key
v = storage.getItem(storage.key(n)) // Get's n'th item
```
## Scope
A simple experiment (see code below) shows that the storage is *per subdomain* and not *per domain*.
### Code
```javascript
const ls = localStorage
ls.setItem("hello","world")
const dump_storage = _ => {
const ls = localStorage
const l = ls.length
for(let i=0; i\n${k} => ${v}\n\n`
}
}
// ...
dump_storage()
```
```javascript
const ls = localStorage
const hello = ls.getItem("hello")
console.log({hello})
const dump_storage = _ => {
const ls = localStorage
const l = ls.length
for(let i=0; i\n${k} => ${v}\n\n`
}
}
// ...
dump_storage()
```