Safest Way to Loop Over Javascript Object
<p>I want to create an object to hold a bunch of properties like</p>

<pre><code>var o = {x: 20, y: 40, color: 'red'};
</code></pre>

<p>More properties can be added to the object throughout its life, so I would like a generic way to loop over the properties to set them later. I know if the Object.prototype has been messed with, simply </p>

<pre><code>for(var prop in o) { ... }
</code></pre>

<p>will cause those properties to be looped over. What other things can cause this to mess up, and what is the safest way to loop like this?</p>
