javascript - How to add self executing function inside a constructor function -


i create constructor like

function foo (){     this.bar=function(){     //something     }; } 

this fine till here wanna add inside self executing function when create object new keyword might this

function foo(){     (function(){     //do create object     })();     this.bar=function(){     //something     }; } 

i want run self executing function when create new object . how can wrote above


Comments

Popular posts from this blog

javascript - Using jquery append to add option values into a select element not working -

Android soft keyboard reverts to default keyboard on orientation change -

jquery - javascript onscroll fade same class but with different div -