Note : - index.html(Dark Mode using Js in html) & the Folder Contain Store data in localstorage using js and Ionic Framework 4.0
- The localStorage object stores 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.
In web Storage There are Main Five Method
- key()
- getitem()
- setitem()
- removeitem()
- clear()
All the method belongs to the Storage Object, which can be either a localStorage object or a sessionStorrage object.
==> The key() method returns name of the key with the specified index.
Get the name of the first local storage item: var x = localStorage.key(1);
==> The getItem() method returns value of the specified Storage Object item. Syntax: localStorage.getItem(keyname)
Get the value of the specified local storage item: var x = localStorage.getItem("mytime");
==>The setItem() method sets the value of the specified Storage Object item. Syntax: localStorage.setItem(keyname, value)
Set the value of the specified local storage item: localStorage.setItem("mytime", Date.now());
==>The removeItem() method removes the specified Storage Object item. Syntax:localStorage.removeItem("mytime");
Remove the the specified local storage item: localStorage.removeItem("mytime");
==> The clear() method removes all the Storage Object item for this domain. Syntax: localStorage.clear()
Remove all local storage items: localStorage.clear();