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 ex2 = {
    attr1: 0,
    attr2: 0,
    attr3: 0
};

//defining a 'watcher' for the attributes
watch(ex2, ["attr2", "attr3"], function(){
    alert("attr2 or attr3 changes!");
});

//when changing one of the attributes its watcher will be invoked
ex2.attr2 = 50;