title: JSON parse error: Cannot read property
body: <p>I have created some little jt code, but it gives me error </p>
  
  <pre><code>function Mind(){
      var request = "request";
      var reply = "reply";
      var words = '';
  
      this.Reply = function(){
          if(request == words.nouns[0].noun){
              reply = words.nouns[0].noun;
          }
          else
              reply = this.words.nouns[0].noun;
      }
  
      this.SetRequest = function(req){
          request = req;
      }
  
      this.GetReply = function(){
          return reply;
      }
  
      this.Parse = function(u){
          var xmlhttp = new XMLHttpRequest();
          var url = u;
          var result;
          xmlhttp.onreadystatechange = function() {
              if (xmlhttp.readyState == 4 &amp;&amp; xmlhttp.status == 200) {
                  words = JSON.parse(xmlhttp.responseText);
              }
          }
          xmlhttp.open("GET", url, true);
          xmlhttp.send();
          return result;
      }
  
      this.Construct = function(){
          words = this.Parse('mind/words.json');
      }}
  
      var mind = new Mind();
      mind.Parse('mind/words.json');
  </code></pre>
  
  <p>and here is my json file </p>
  
  <pre><code>{
      "nouns": [
          {"noun": "child"},
          {"noun": "father"}
      ]
  }
  </code></pre>
  
  <p>In command live all goes well, but when I run this code, appears error </p>
  
  <blockquote>
    <p>Uncaught TypeError: Cannot read property 'nouns' of undefined</p>
  </blockquote>