[{'id':1,'content':'something'},{'id':2,'content':'something diff'},{'id':3,'content':'something diff'}]
by localStorage.getItem('data')
I got the above json object, but how to delete the id 2 item?
[{'id':1,'content':'something'},{'id':2,'content':'something diff'},{'id':3,'content':'something diff'}]
by localStorage.getItem('data')
I got the above json object, but how to delete the id 2 item?
Assuming you've JSON.parse'd your local storage data into an array, you can remove the second item like you would from any other array- by popping it off.
This will turn "data" into a javascript object and remove the last item (assuming this is always an array):