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

Popular posts from this blog

android - Spacing between the stars of a rating bar? -

aspxgridview - Devexpress grid - header filter does not work if column is initially hidden -

c# - How to execute a particular part of code asynchronously in a class -