JSFiddle - React, Tailwind, and code Playground

JavaScript

function test(elem, opt){
   this.opt = opt;
   this.elem = $(elem);
   this.method1();
}

test.prototype.method1 = function() {
    var data = {
        output: 1
    };
   this.method2(data);
   console.log(data.output);
}

test.prototype.method2 = function(data) {
   data.output += 1;
}

var inst = new test();