localStorage is part of the Web Storage API and is accessed in JavaScript through the read-only localStorage property of the window object. Each origin gets its own storage area, and both keys and values are stored as strings.
Data saved in localStorage has no expiration time and remains after the browser is closed and reopened. This sets it apart from sessionStorage, whose data is cleared when the page session ends.