title: javascript custom scope binding function
body: <p>I am reading this article - <s><a href="http://www.robertsosinski.com/2009/04/28/binding-scope-in-javascript/" rel="nofollow">http://www.robertsosinski.com/2009/04/28/binding-scope-in-javascript/</a></s> - where a custom bind function is made.</p>
  
  <pre><code>Function.prototype.bind = function(scope) {
    var _function = this;
  
    return function() {
      return _function.apply(scope, arguments);
    }
  }
  
  alice = {
    name: "alice"
  }
  
  eve = {
    talk: function(greeting) {
      console.log(greeting + ", my name is " + this.name);
    }.bind(alice) // &lt;- bound to "alice"
  }
  
  eve.talk("hello");
  // hello, my name is alice
  </code></pre>
  
  <p>My question is this line in particlar </p>
  
  <pre><code> return function() {
      return _function.apply(scope, arguments);
    }
  </code></pre>
  
  <p>Why is the <strong>return</strong> in _function.apply(scope, arguments); there?  And what is it doing and what is being returned?
  I removed that return and it still works.  </p>