I never managed to ask before:
Why this backward way is so often used for constructors:
myConstructor = function() { /*empty placeholder*/ }
// and then:
myConstructor.p rototype.method One = function() {...}
myConstructor.p rototype.method Two = function() {...}
instead of right away:
function myConstructor() {
this.methodOne = function() {...}
this.methodTwo = function() {...}
}
Is it just a tradition or is it a workaround of some problem I'm not
aware of?
Why this backward way is so often used for constructors:
myConstructor = function() { /*empty placeholder*/ }
// and then:
myConstructor.p rototype.method One = function() {...}
myConstructor.p rototype.method Two = function() {...}
instead of right away:
function myConstructor() {
this.methodOne = function() {...}
this.methodTwo = function() {...}
}
Is it just a tradition or is it a workaround of some problem I'm not
aware of?
Comment