What is local storage?
Local Storage is a data storage type of web storage. That allows the JavaScript sites to store and access the data without any expiration date. This means that the data will always be persisted and will not expire. So, data stored in the browser will be available even after closing the browser window. But it will be gone if the user resets his browser or uninstalled it.
How to view the local storage database?
To view you will need to open the developer tools in your browser then click on the arrow at the top and choose application.
Then choose the local storage, then click on the server you want to view, And that's it.
How to add local storage items using js?
You can easily add items using this snippet:
LocalStorage.setitem("key", "value");
And that's it
How to get the value of an item in js?
Const value = LocalStorage.getItem("key");
console.log(value)
How to delete an item?
Localstorage.removeItem('key")
How to clear all the data?
Locastorage.clear()
And that's all, you just learned Local storage:)
Top comments (0)