JSFiddle - React, Tailwind, and code Playground

HTML

<button id="mybutton">click me</button>

JavaScript

function MyClass() {
    this.Property = 5;
    var self = this;
    
    document.getElementById('mybutton').addEventListener('click', function() { self.onClick(); });
}

MyClass.prototype.onClick = function() {
    var self = this;
    return function() {
        console.log(self.Property);
    }
}

var myclass = new MyClass();