I have following function :
  function a() {
    var d = {
      foo : "text"
    };
    for(var b in c) {
      if(c.hasOwnProperty(b)) {
        d[b] = function() {
          return c[b].apply(this, arguments);
        };
      }
    }
    return d;
  }
  var c = {
    a : function() { alert(this.foo); },
    b : function() { return this.a(); }
  }
  a().a(); // nothing happens
  // but the following works :
  var c = {
    a : function() { alert(this.foo); }
  }
  a().a(); // output : text
I think this happens because of this in the .apply method. How can I fix this?
 
     
    