replace localStorage[key] with getItem() and setItem()