Skip to content

Commit 50104c2

Browse files
committed
Update "LocalStorage, sessionStorage" article
1 parent ef15805 commit 50104c2

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

6-data-storage/02-localstorage/article.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,11 @@ What's interesting about them is that the data survives a page refresh (for `ses
66

77
We already have cookies. Why additional objects?
88

9-
- Unlike cookies, web storage objects are not sent to server with each request. Because of that, we can store much more. Most browsers allow at least 2 megabytes of data (or more) and have settings to configure that.
9+
- Unlike cookies, web storage objects are not sent to server with each request. Because of that, we can store much more. Most modern browsers allow at least 5 megabytes of data (or more) and have settings to configure that.
1010
- Also unlike cookies, the server can't manipulate storage objects via HTTP headers. Everything's done in JavaScript.
1111
- The storage is bound to the origin (domain/protocol/port triplet). That is, different protocols or subdomains infer different storage objects, they can't access data from each other.
1212

13-
Both storage objects provide same methods and properties:
13+
Both storage objects provide the same methods and properties:
1414

1515
- `setItem(key, value)` -- store key/value pair.
1616
- `getItem(key)` -- get the value by key.
@@ -124,7 +124,7 @@ The latter works, because `Object.keys` only returns the keys that belong to the
124124

125125
Please note that both key and value must be strings.
126126

127-
If were any other type, like a number, or an object, it gets converted to string automatically:
127+
If they were any other type, like a number, or an object, they would get converted to a string automatically:
128128

129129
```js run
130130
localStorage.user = {name: "John"};
@@ -219,7 +219,7 @@ Modern browsers also support [Broadcast channel API](mdn:/api/Broadcast_Channel_
219219
220220
## Summary
221221
222-
Web storage objects `localStorage` and `sessionStorage` allow to store key/value in the browser.
222+
Web storage objects `localStorage` and `sessionStorage` allow to store key/value pairs in the browser.
223223
224224
- Both `key` and `value` must be strings.
225225
- The limit is 5mb+, depends on the browser.

0 commit comments

Comments
 (0)