JSFiddle - React, Tailwind, and code Playground

by oroce

JavaScript

function YourObj() {
    this.close = function() {
        if (this.isOpen) {
            alert("almafa");
            this.isOpen = false;
        }
    };
    this.open = function() {

        this.isOpen = true;
    };
    return this;
}
var myObj = new YourObj();
myObj.open();
myObj.close();