阅读背景:

关于何时将参数传递给方法或让方法从类中获取所需的数据,是否存在任何良好实践/规则?

来源:互联网 

I mean this more exactly:

我更准确地说是这个:

var MyClass = function(){
    return {
        init: function(a, b, c){
            this.__a = a;
            this.__b = b;
            this.__c = c;
        }
        ,doSomething: function(){
            // when to use this:
            this.__subThingType1();
            // or this?
            this.__subThingType2(this.__a, this.__b, this.__c);
        }
        ,__subThingType1: function(){
            var a = this.__a;
            var b = this.__b;
            var c = this.__c;
            // do dirty things with a, b and c
        }
        ,__subThingType2: function(a, b, c){
            // do dirty things with a, b and c
        }
}​
var My



你的当前访问异常,请进行认证后继续阅读剩余内容。

分享到: