Rules for unquoted JavaScript Object Literal Keys?
<p>In JavaScript, you can define an object like this:</p>

<pre><code>var d = {1: 'test'};
</code></pre>

<p>and I can set a key with a negative number index like this:</p>

<pre><code>d[-1] = 'test2';
</code></pre>

<p>but if I try to use a negative number in the literal initialization, I get an error:</p>

<pre><code>var d = {1: 'test', -1: 'test2'};
Uncaught SyntaxError: Unexpected token -
</code></pre>

<p>Why is this? Why can't I use a literal negative number as a key to an object? Is there a workaround that allows me to initialize it as a literal. I know I could use strings instead, but I want to use integers.</p>
