title: How to access javascript object Arrays inside prototype function
body: <p>Hello I'm having a problem that haven't searched before</p>
  
  <p>I'm trying to recode my javascript used for accessing google api's so that I can create objects to access them in further projects .
  Let me Explain the Code because I'm not posting the original code here below code is the just like an example of my code</p>
  
  <p>I'm a having constructor function and it has arrays declared with 'this' keyword. and Then I have an prototype of the constructor function and inside that prototype I had a nameless function created to access jquery requested output from a server.But I'm unable to access those array objects</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>function cons(){
   this.objectarray = [];
  }
  cons.prototype.profun = function(){
   this.objectarray[0] = 'working';
   alert(this.objectarray[0]);//Access is possible
   $.get('requesting url',{'parameters'},function(data){
    alert(this.objectarray[0]);//Access is not possible
   });
  }</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"&gt;&lt;/script&gt;</code></pre>
  </div>
  </div>
  </p>
  
  <p>when I try to access the object inside that jquery function I'm getting this error from browser console</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="false" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>TypeError: this.YouTubeTitle is undefined</code></pre>
  </div>
  </div>
  </p>