Created
June 13, 2018 07:27
-
-
Save Kcko/8128f718a67dcff1614640e48bd2db20 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1) | |
var Abc = function(aProperty,bProperty){ | |
this.aProperty = aProperty; | |
this.bProperty = bProperty; | |
this.init = function(){ | |
// Do things here. | |
} | |
this.init(); | |
}; | |
var currentAbc = new Abc(obj,obj); | |
2) | |
var Abc = function(aProperty,bProperty){ | |
function privateInit(){ console.log(this.aProperty);} | |
this.aProperty = aProperty; | |
this.bProperty = bProperty; | |
privateInit.apply(this); | |
}; | |
3) | |
var Abc = function(aProperty,bProperty){ | |
this.aProperty = aProperty; | |
this.bProperty = bProperty; | |
//init | |
(function () { | |
// Perform some operation | |
}.call(this)); | |
}; | |
var currentAbc = new Abc(obj,obj); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment