localStorage.getItem('item') or localStorage.item
localStorage.setItem('item', 'blablabla) or localStorage.item = 'blablabla'
const key = 'length';
localStorage[key] = 100;
console.log(localStorage[key]); // 0
console.log(localStorage.getItem(key)); // null
const key = 'length';
localStorage.setItem(key, 100);
console.log(localStorage[key]); // 1
console.log(localStorage.getItem(key)); // 100 (строкой)
Note: It's recommended to use the Web Storage API (setItem, getItem, removeItem, key, length) to prevent the pitfalls associated with using plain objects as key-value stores.