JSFiddle - React, Tailwind, and code Playground

HTML

<script src="https://rawgithub.com/melanke/Watch.JS/master/src/watch.js"></script>

JavaScript

//defining our object no matter which way we want
var ex1 = {
    attr1: "initial value of attr1",
    attr2: "initial value of attr2"
};

//defining a 'watcher' for an attribute
watch(ex1, "attr1", function(){
    alert("attr1 changes!");
});

//when changing the attribute its watcher will be invoked
ex1.attr1 = "other value";