How do I get the id value of localstorage

How do I get the id value of localstorage
0

#1
for (var i = 0; i < localStorage.length; i++){
     console.log(localStorage.getItem(localStorage.key(i)));
}

the console log will output 

[{"id":"500","joke":" User title : Chuck Norris can access the DB from the UI."},{"id":"464","joke":" User title : \"It works on my machine\" always holds true for Chuck Norris."},{"id":"2","joke":" User title : MacGyver can build an airplane out of gum and paper clips. Chuck Norris can kill him and take it."}]

but I want to get all the id's

#2

#3

How would you implement that method to my codes


#4

map replaces your for loop. Read the documentation on how you would implement it.


#6

Because we don’t know what do you have in the localstorage I think that you are trying to get the ‘key’ of the localstorage… But I don’t know, maybe every value in the store is an array just like your example, that way is correct you just need to use the map function.