In my local storage, I have some data stored in a unique format. When I try to retrieve the data using localStorage.getItem('id');
, it returns undefined. The issue lies in the way the data is stored within localStorage - it's structured as abcabcabc.id
. This unique identifier part ("abcabcabc") changes for each user session. Despite this challenge, I need to find a way to extract the value of id
. Is there a method to compare strings and isolate only those that contain ".id" for retrieval? If so, could you provide an explanation on how this can be accomplished?
Data stored in localStorage:
abcabcabc.username.id = sdfsdfsdfs
abcabcabc.username.refreshToken = sdfsdfs
abcabcabc.username.accessToken = ertsdffdg