JSFiddle - React, Tailwind, and code Playground
JavaScript
function newObj(){
this.v1 = 10;
this.v2 = 20;
this.func1val = (function(){ alert('called from c\'tor'); })();
this.func2val = (function(){ return 2 + 1; })();
}
var temp = new newObj();
alert('temp.func2val = ' + temp.func2val);