I have an array filled with objects:
array = [{...}, {...}, {...}];
To store this array in localStorage, I need to convert it into a string. To do this, I initially tried using:
array.join()
However, the result was not what I expected:
// [object Object],[object Object],[object Object]
Afterwards, I decided to use:
JSON.stringify(array);
Surprisingly, this method worked perfectly and my output was:
// [{text}, {text}, {text}]
This raises the question: why does 'join()' not function like 'stringify()' in this scenario?