<p>I've declared Javascript arrays in such a way that I could then access them by a key, but it was a long time ago, and I've forgotten how I did it.</p>

<p>Basically, I have two fields I want to store, a unique key, and its value. I know there is a way to do it.. something like:</p>

<pre><code>var jsArray = new {key: 'test test', value: 'value value'},
              new {key: 'test 2', value: 'value 2'};
</code></pre>

<p>and accessed like:</p>

<pre><code>value = jsArray[key]
</code></pre>

<p>Can someone remind me?</p>

You can do it in different ways:
```
```
var a = {'a':0, 'b':1, 'c':2};

var b = new Array();
b['a'] = 0;
b['b'] = 1;
b['c'] = 2;

var c = new Object();
c.a = 0;
c.b = 1;
c.c = 2;
```
```