checking hasOwnProperty in for in loop