JSFiddle - React, Tailwind, and code Playground

by demee

JavaScript

function Button(text){
    this.text = text; 
    
    function makeItClick(){
        alert("clicked");
    }
    
    this.click = function(){
        makeItClick();
    }
}            

var button = new Button(); 
button.click();