JSFiddle - React, Tailwind, and code Playground

JavaScript

function ConstructorFunctionName() {
    var changeVar = 'foo'; /*this.changeVar = 'foo'; // this can also be used */

    this.initialize = function() { /* all init here */
    };
    this.render = function() { /* all render here */
    };
    this.printFoo = function(event) {
        var printVar = changeVar;
        alert(printVar);
    };
    this.changeFoo = function(event) {
        alert(changeVar);
    };
};

var foo = new ConstructorFunctionName();

foo.printFoo();