So is there a way to fire an event when a variable is changed? It doesn't seem like that's possible unless you have something to watch that variable or a method that changes that variable but I've got a program that would be a lot easier to write if this were possible.
In js if you change something like an image DOM objects width property the image width will update automatically. If you change a scrollable objects scrollTop value it will automatically scroll. You don't need to use a setWidth() method or setScroll() method (in most cases).
How does this work? Could I replicated it?
Ex:
    DOM = document.getElementById("testInput"); // text input field
    variable = 10;
    DOM.value = variable;
    variable.onchange = function(val){DOM.value = val;} // ???
    //or possibly
    window.observe(variable, function(val){DOM.value = val;} // ???
Weird stuff I know...