Safely get a value for a specific local storage key
- Source:
Parameters:
| Name | Type | Description |
|---|---|---|
key |
string
|
localStorage key to get |
Returns:
- Type:
-
string
- returns the value of the localStorage key
Example
getLocalStorage('foo'); // returns 'bar'