text: /*
   * function bind():
   *
   * example 1:
   *
   * var alice = {
   *   name: 'alice',
   *   shout: function(){
   *     alert(this.name);
   *   }
   * }
   * var boundShout = bind(alice.shout, alice);
   * boundShout(); // alerts 'alice'
   * boundShout = bind(alice.shout, {name: 'bob'});
   * boundShout(); // alerts 'bob'
   *
   * example 2:
   *
   * var func = function(a, b){ return a + b };
   * var boundFunc = bind(func, null, 'foo');
   * var result = boundFunc('bar');
   * result === 'foobar'; // true
   *
   */
  
  var bind = function() {
    var outerArgs = Array.prototype.slice.call(arguments);
    var func = outerArgs[0];
    var context =  outerArgs[1];
  
    return function(){
      var innerArgs = Array.prototype.slice.call(arguments);
      var args = outerArgs.slice(2).concat(innerArgs);
  
      return func.apply(context, args);
    };
  };
  
  /*
   * Function.prototype.bind:
   *
   * example 1:
   *
   * var alice = {
   *   name: 'alice',
   *   shout: function(){
   *     alert(this.name);
   *   }
   * }
   * var boundShout = alice.shout.bind(alice);
   * boundShout(); // alerts 'alice'
   * boundShout = alice.shout.bind({name: 'bob'});
   * boundShout(); // alerts 'bob'
   *
   * example 2:
   *
   * var func = function(a, b){ return a + b };
   * var boundFunc = func.bind(null, 'foo');
   * var result = boundFunc('bar');
   * result === 'foobar'; // true
   *
   */
  
  Function.prototype.bind = function() {
    var outerArgs = Array.prototype.slice.call(arguments);
    var func = this;
    var context =  outerArgs[0];
  
    return function(){
      var innerArgs = Array.prototype.slice.call(arguments);
      var args = outerArgs.slice(1).concat(innerArgs);
  
      return func.apply(context, args);
    };
  };
  