how can I do that? In PHP I have the $$name form for doing that but in js I don't know how to solve this.
...
// rest of the code
var books = [
{'h':'book 1','i':[ {'s':'1','w':'some text'}, {'s':'2','w':'other text'} ] }
];
var infos = [
{'h':'HERE','i':[ {'h':'something','i':[ {'v':[{'g':1,'b':0}],'h':'text X','a':['bla','bla', 'bla']}]} ] }
];
var arrNames = ['books','infos'];
let z = document.getElementById('output');
for( i=0;i<arrNames.length;i++ ){
arr = localStorage.getItem(arrNames[i]).split(','); // doesnt work :(
html += arr[0]['h']+'<br>';
}
z.innerHTML = html;
output should to be:
book 1
HERE
but how?
Solution Update:
thx @ Heretic Monkey and his link
arr = window[arrNames[i]][j]['h'];