I want to create an object to hold a bunch of properties like
var o = {x: 20, y: 40, color: 'red'};
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
for(var prop in o) { ... }
will cause its properties to also be looped over. What other things can cause this to mess up, and what is the safest way to loop like this?