Stores a value in the web browser's local storage.
Web browsers can save small amounts of data using the built-in localStorage object. Data stored in localStorage
can be retrieved at any point, even after refreshing a page or restarting the browser. Data are stored as key-value pairs.
storeItem()
makes it easy to store values in localStorage
and getItem() makes it easy to retrieve them.
The first parameter, key
, is the name of the value to be stored as a string.
The second parameter, value
, is the value to be stored. Values can have any type.
Note: Sensitive data such as passwords or personal information shouldn't be stored in localStorage
.
Ejemplos
Sintaxis
storeItem(key, value)
Parámetros
key
String:
name of the value.
value
String|Number|Boolean|Object|Array:
value to be stored.
Notice any errors or typos? Please let us know. Please feel free to edit src/data/local_storage.js and open a pull request!