Using a variable as part of a javascript array
<p>I have an object (that I can change!) that looks like this:</p>

<pre><code>var pageContent = {
    "contact_us":[{
        "content":"&lt;p&gt;Lots of content here.&lt;/p&gt;",
        "title":"Contact Us"
     }],
    "index":[{
        "content":"&lt;p&gt;Some other content here.&lt;/p&gt;",
        "title":"Home Page"
     }],
    "gallery":[{
        "content":"&lt;p&gt;Some more content&lt;/p&gt;",
        "title":"Gallery"
     }],
 }
</code></pre>

<p>To access properties, I'm doing this:</p>

<pre><code>pageContent.gallery[0]['title'];
</code></pre>

<p>To get the value "Gallery".</p>

<p>What I want to do is something like this:</p>

<pre><code>var newPage = "gallery";
pageContent.newpage[0]['title'];
</code></pre>

<p>But, obviously that fails. How can I do what I want? Changes to anything are welcome, nothing is set in stone here.</p>
