I have added some key values pairs in local storage. Now I want to fetch both values and keys and append its values in li. I am trying to it like this right now.
for ( var i = 0; i < localStorage.length; ++i ) {
var li = document.createElement("li");
li.appendChild(document.createTextNode(localStorage.getItem(localStorage[key]) + " " + localStorage.getItem(localStorage.key(i))));
ol.appendChild(li);
}
I want an output key value pairs like:
key1 value1
key2 value2