Verify hasOwnProperty when iterating over object