you should guard the loop against !hasOwnProperty