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
Post a Comment