I am encountering an issue with an array that I have declared like this:
array = [];
The array contains values that look like this -
....
ChIJOaegwbTHwoARg7zN_9nq5Uc:"ChIJOaegwbTHwoARg7zN_9nq5Uc"
ChIJXTwCdefHwoAR9Jr4-le12q4:"ChIJXTwCdefHwoAR9Jr4-le12q4"
....
When I try to print these values using console.log(array), it works. However, when attempting JSON.stringify(array), it does not work as expected. I am trying to store this array in localStorage using localStorage.setItem().
I tested a similar example in the browser console:
var arr=[]
arr[0] = 1
arr[1] = 2
JSON.stringify(arr);
The above example worked perfectly, which is leaving me puzzled about the issue with my current array. I have spent hours trying to resolve this. Any insights or suggestions would be greatly appreciated.