// A simple Javascript Object / String
var object = "hello";
// Imagine a button in the DOM, and if it's clicked the object value will change
document.getElementById("button").onclick = function(){
window.object = "hello world";
}
// Now I would like to track and do something when the object is changed, ex:
object.onreadystatechange = function(){
alert(object);
}
Note: This could sound stupid, because I could get the change in the onclick
event on the button, but this is not what I want, I want strictly to track the change on the object itself for any kind of use, the above code is is just an example.