Sometimes, we want to get HTML5 localStorage keys with JavaScript.
In this article, we’ll look at how to get HTML5 localStorage keys with JavaScript.
How to get HTML5 localStorage keys with JavaScript?
To get HTML5 localStorage keys with JavaScript, we can use the Object.entries
method.
For instance, we write
const entries = Object.entries(localStorage);
to call Object.entries
with localStorage
to return an array with the key-value pair arrays in localStorage
.
Conclusion
To get HTML5 localStorage keys with JavaScript, we can use the Object.entries
method.