Add hasOwnProperty() check in 'for in' loop