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 ex3 = {
attr1: 0,
attr2: "initial value of attr2",
attr3: ["a", 3, null]
};
//defining a 'watcher' for the object
watch(ex3, function(){
alert("some attribute of ex3 changes!");
});
//when changing one of the attributes of the object the watcher will be invoked
ex3.attr3.push("new value");