localStorage—used for long-term storage. This data persists after the window is closed and is shared across all browser windows.
sessionStorage—used for ephemeral data related to a single browser window. Data stored in the sessionStorage object does not persist after the window is closed and is not shared with other windows.
A note on storing objects using local storage: