Raise event whenever object property is added in Javascript?
<p>I have a Javascript  object : </p>

<p><code>var obj={...};</code></p>

<ul>
<li><p>How can I execute a function whenever a new property is added/changed : </p>

<p>For example:<code>obj["newItem"]=3;</code></p></li>
<li><p>is there any way also for arrays ? (excpet override <code>push</code> in prototype)</p></li>
<li><p>is there any way to do it also for assign a different object to the same variable ?</p>

<p>example : </p>

<pre><code>var obj={...};
    obj={...}; //redifine
</code></pre></li>
</ul>
