Keep this as context of base object in properties of javascript object -
i wondering need maintain type of (var self = this) coupling within sub properties of java script object. example, if had following object:
var t = { helpers: { getname: function(){ //how preserve or mbase object instance here... //so can example following: var self = this;//this helpers object, how base object? return self.nickname + "..."; }, gettime: function(){ } }, nickname: 'test' }
from understand currently, reference when in object, directly passed down function if property of object. since scenario 2 objects don, base or "helpers" object when reference (var self = this) , if so, how reach base object property such "nicknam" within obj.helpers.getnickname()?
thanks in advance.
Comments
Post a Comment