JSFiddle - React, Tailwind, and code Playground

by path411

HTML

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

JavaScript

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

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

var myclass = new MyClass();