A problem. Again. Here is the code:
if(localStorage.getItem("temporaryArray")){
var temporaryArray = JSON.parse(localStorage.getItem("temporaryArray"));
}else{
var temporaryArray = [];
}
So basically what it does is that when a new page is loaded I don't want to reset the array because later in the code I assign something to this array in localStorage. So what I'm trying to say is that if you can get this item, then when the code is loaded again assign this variable to the localStorage item. Else, just set it to an empty array. But here is the error I'm getting because the array is currently empty(I think that's the reason why):
Uncaught SyntaxError: Unexpected token o in JSON at position 1
at JSON.parse (<anonymous>)
at main.js:61
Any help would be very much appreciated.
settemporaryArray - my guess is, you are not usingJSON.stringify- because of theoin[object Object]JSON.stringify. If not,[object Object]will be set and henceUnexpected token o in JSON at position 1