π· About HTML Web Storage API - 2
A Threadπ§΅ π
π The localStorage Object
β The localStorage object stores the data with no expiration date.
β The data will not be deleted when the browser is closed, and will be available the next day, week, or year.
β Example explained:-
β’ Create a localStorage name/value pair with name="lastname" and value="Smith" .
β’ Retrieve the value of "lastname" and insert it into the element with id="result".
β The example given in the above tweet could also be written like this,
β The syntax for removing the "lastname" localStorage item is as follows.
β Note: - Name/value pairs are always stored as strings. Remember to convert them to another format when needed!
π The sessionStorage Object
β The sessionStorage object is equal to the localStorage object, except that it stores the data for only one session.
β The data is deleted when the user closes the specific browser tab.
β The following example counts the number of times a user has clicked a button, in the current session.
Thanks for reading this thread β€οΈ
If you like it , make sure you:
π· Like the tweet
π· Retweet the first tweet β‘
For more content , follow:
@MrunayU