JSFiddle - React, Tailwind, and code Playground

by path411

HTML

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

JavaScript

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

MyClass.prototype.onClick = function() {
    return function() { alert(this.Property) };
}