How can I return the object from constructor from inside the constructor?
function consFunc() {
this.flag = 'someFlag';
this.pol = 'somePole';
}
consFunc.prototype.foo = function(){
console.log(this.flag);
}
var obj = new consFunc();
obj.foo();
This is how usually I make object from constructor. How can I return object from inside the constructor function so I no need to write var obj = new consFunc(); I just simply call obj.foo(); for my need, is it possible?
objbe if it isn'tnew consFunc();?new consFunc();?