javascript - Access instance of anonimous function inside of itself -


how instance of anonymous function inside of itself?

function () {     //how access this?  } 

it must anonymous, callback, , in function passed attaching property callback , invoke it. should return own property.

function parent (val) {     val.someprop = "abc"     val() } parent(function(){     return this.someprop; // how access someprop because window? }) 

also can't pass props it.

i'm not sure programming practise send argument itself:

function parent(val) {     val.someprop = "abc";     val(val); }  parent(function(val){     console.log(val.someprop); }); 

Comments

Popular posts from this blog

ios - RestKit 0.20 — CoreData: error: Failed to call designated initializer on NSManagedObject class (again) -

java - Digest auth with Spring Security using javaconfig -

laravel - PDOException in Connector.php line 55: SQLSTATE[HY000] [1045] Access denied for user 'root'@'localhost' (using password: YES) -