title: JSON attribute unreachable - "Cannot read property of undefined"
body: <p>I am attempting to use the Wikipedia API to retrieve article titles and snippets of the article's text. But when I try to access those properties, I am getting the error "Cannot read property of undefined."</p>
  
  <p>Here is my JSON response:</p>
  
  <pre><code>{
      "batchcomplete": "",
      "continue": {
          "gsroffset": 10,
          "continue": "gsroffset||"
      },
      "query": {
          "pages": {
              "13834": {
                  "pageid": 13834,
                  "ns": 0,
                  "title": "\"Hello, World!\" program",
                  "index": 6,
                  "extract": "&lt;p&gt;A &lt;b&gt;\"Hello, World!\" program&lt;/b&gt; is a computer program that outputs or displays \"Hello, World!\" to a user. Being a very simple program in most programming languages, it is often used to illustrate the&lt;/p&gt;..."
              },
              "6710844": {
                  "pageid": 6710844,
                  "ns": 0,
                  "title": "Hello",
                  "index": 1,
                  "extract": "&lt;p&gt;&lt;i&gt;&lt;b&gt;Hello&lt;/b&gt;&lt;/i&gt; is a salutation or greeting in the English language. It is first attested in writing from 1826.&lt;/p&gt;..."
              },
              "1122016": {
                  "pageid": 1122016,
                  "ns": 0,
                  "title": "Hello! (magazine)",
                  "index": 7,
                  "extract": "&lt;p&gt;&lt;i&gt;&lt;b&gt;Hello&lt;/b&gt;&lt;/i&gt; (stylised as &lt;i&gt;&lt;b&gt;HELLO!&lt;/b&gt;&lt;/i&gt;) is a weekly magazine specialising in celebrity news and human-interest stories, published in the United Kingdom since 1988. It is the United Kingdom&lt;/p&gt;..."
              }
          }
      }
  }
  </code></pre>
  
  <p>I have tried a couple different ways of writing the code. For example, this works (logs the pages as an object in the console):</p>
  
  <pre><code>console.log(response.query.pages);
  </code></pre>
  
  <p>But this returns the error I wrote above ("Cannot read property of undefined"):</p>
  
  <pre><code>console.log(response.query.pages[0].title);
  </code></pre>
  
  <p>Any suggestions on how to access the attributes "title" and "extract" would be appreciated. Thanks.</p>