using hasOwnProperty for object loops