JavaScript - hasOwnProperty in `for-in` loops