Auto overriding context in javascript functions -
take in consideration code:
function a() { alert(this.variable); } b = new function() { this.variable = "abc"; a.call(this); } is there way auto override context instead of using call method? (not working):
function a() { var _this = function.caller; alert(_this.variable); } b = new function() { this.variable = "abc; a(); } thanks in advance.
if want a have access b's this, you'll have pass this explicitly, i.e. instead of a() a(this).
Comments
Post a Comment