Instantly share code, notes, and snippets.

@Kcko /demo.js
Created Jun 13, 2018

Embed
What would you like to do?
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