+ 1
How?
How use localStorage.setItem and localStrage.getItem with JS, because he added numbers and not chars
1 Antwort
+ 1
if (typeof(Storage) === 'undefined') {
/*browser does not support localstorage*/
} else {
/* storage code goes here */
}
localStorage.setItem(key, value);
Sets a value to a key.
localStorage.getItem(key);
Returns a key's value
localStorage.clear();
Clears the storage
Local storage can only use strings.
Convert your variables to string when setting them
and convert them back when accessing