I am inserting data into localstorage with key that starts with G:
What I like to do is to sort them in a certain order when it is retreived back and displayed.
I tried 1G, 2G,3G, etc. but does not seem to come out in that order.
Am I doing something wrong?
getItem(.....)
Items in localstorage are in the order you add them. If you want to sort them you’ll have to get all the items and then sort them yourself.
If you want sorting then you should look into IndexedDB or the older Web SQL if you’re needing to support older WebKit/iOS.