JSON.parse() from localStorage issue
<p>I am currently working on a little browser game and I am using the HTML localStorage to save some data.</p>

<p>The problem:
I have an empty array that i will later <code>.push()</code> some data into. I am storing this array in the localStorage but when i try to read from the local storage it doesn't work. </p>

<p>The Chrome Developer Tools console is giving me this error:
"Uncaught SyntaxError: Unexpected token u" when trying to parse the data from localStorage.</p>

<p>Here's the code i am using:</p>

<pre><code>var allContracts = [];
localStorage["allContracts"] = JSON.stringify(allContracts);

allContracts = JSON.parse(localStorage["allContracts"]);
</code></pre>

<p>There is more code than this but none of it is interacting with these in any way.</p>

<p>Is there a quirk with localStorage or JSON that i am not aware of and is causing this? (i am not very familiar with JSON or localStorage)
Should i be doing this a different way?
Or am i just missing an obvious mistake?</p>

<p>Thanks in advance :)</p>