title: JavaScript - error this.first() is not a function
body: <p>I'm just playing around and trying to figure out how the <strong>this</strong> object works and how do I pass scopes context with the <strong>bind</strong> function.<br>
  So far I got to this point (check code below), and found out that I can use bind with an object function in order to pass the scope of <strong>myObject</strong> to the object function <strong>run</strong>.</p>
  
  <p>first question: </p>
  
  <blockquote>
    <p>why do I need to use this.first() instead of first()?</p>
  </blockquote>
  
  <p>Because otherwise its still using <strong>second's</strong> context.</p>
  
  <pre><code>    myObject = {
      first: function(){ console.log("myObject's first()")},
      second: function(){ 
          function first(){ console.log("second's first()")};
          let run = function(){ this.first()}.bind(this);
          run();
  
      },
  }
  
  myObject.second()
  </code></pre>
  
  <p>Next, I wanted to take it to the next level and I nested another function within <strong>second</strong> (check code).
  Second question: </p>
  
  <blockquote>
    <p>From the code below i get the error <strong>Error: this.first is not a
    function</strong>, and whether i invoke <strong>.bind(this)</strong> or not it gives the
    same error, any clue why does this happen?</p>
  </blockquote>
  
  <pre><code>myObject = {
      first: function(){ console.log("myObject's first()")},
      second: function(){ 
          function first(){ console.log("second's first()")};
          function secondx2(){
              function first(){ console.log("secondx2's first()")};
              let run = function(){ this.first()}
              run();
          }
          secondx2();
      },
  }
  
  myObject.second()
  </code></pre>