Hello! Working on it.
Catch up wih the Appery.io community on our forum. Here you'll find information on the lastest questions and issues Appery.io developers are discussing.
https://forum.appery.io/
Hello! Working on it.
thx much!
It's not clear from your screenshot are those objects in array or object. Anyway they should be in array. So in localStorage should be the following line as elements order in array is not defined:
pre[{"language": "U.S. English", "female": "Allison, Susan", "male":"Dave, Steven, Victor"}, {"language": "U.S. English", "female": "Allison, Susan", "male":"Dave, Steven, Victor"}]/pre
Then you can parse it to variable and continue work with objects array:
pretry {
var arr = JSON.parse(localStorage.getItem("varName"));
if ({}.toString.call(arr) !== "[object Array]") {
alert("Some wierd data in localstorage...");
} else {
alert(arr[0]['male']);
}
} catch ( e ) {
alert("Parse Error. Some wierd data in localstorage...");
}/pre
where varName - variable name in localStorage
[0] - firat element (indexes counting from 0)
block try-catch and this part preif ({}.toString.call(arr) !== "[object Array]")/pre are added because in localStorage might be stored data you're not expecting. So you always have to check what you get in response.
Many many thanks!!
working perfectly!!!
THANKS!!!
working perfectly!!!