The correct methods are setItem(), removeItem(), and clear(). The HTML5 Web Storage API exposes localStorage as a persistent key-value storage object for the current origin. Data stored in localStorage remains available after page reloads and browser restarts unless it is explicitly removed or cleared. setItem(key, value) stores a value under a named key or updates the value if the key already exists. removeItem(key) deletes one specific key-value pair from storage. clear() removes all key-value pairs from the storage object for that origin. These methods are part of the standard Storage interface used by both localStorage and sessionStorage. write is not a Web Storage method; it is associated with document-writing behavior, not application state storage. cookie is also incorrect because cookies are a separate browser storage mechanism accessed through document.cookie, not a method of localStorage. References/topics: Web Storage API, localStorage, Storage interface, application state, persistent key-value data.
==========
Contribute your Thoughts:
Chosen Answer:
This is a voting comment (?). You can switch to a simple comment. It is better to Upvote an existing comment if you don't have anything to add.
Submit