开发者

how to get context which method is applied to

deprecated: bad example

Is it feasible to get execution context (object reference) which method is applied to not passing additional reference of 'someObject' as 'someMethod' argument in last line of code?

var someObj开发者_开发百科ect = {
    prop1 : 'value1'
};

var someMethod = function() {
    // TODO: how to get prop1 value from here?
};

someMethod.call(someObject);

Thanks.


this.prop1 will do the magic for you.


simply someObject.prop1 will get you the value

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜