It is usually necessary to test object.hasOwnProperty(variable) to determine whether the property name is truly a member of the object or was found instead on the prototype chain. for (myvar in obj) { if (obj.hasOwnProperty(myvar)) { ... } }

