There are a lot of Javascript code using for in loops with hasOwnProperty. For example.

 
var fileList = {
    'cache' : 'cache.js',
    'track' : '/log/track.js',
    'jquery' : '/lib/jquery.min.js'
};
 
for ( var f in fileList ) {
    fileList.hasOwnProperty(f) && (fileList[f] = dealString(fileList[f]);
}
 

Because the for in loop will list all properties in the object, includes the prototype property.

 
fileList.__proto__.abc = 'abc';
for(var f in fileList ) console.log(f);
 

Without hasOwnProperty to filter, the abc will be listed too.

Actually, in Javascript, hasOwnProperty is the only function that deals with properties without traversing the prototype chain. So you have no choice when you want to filter out the prototype properties.

There are many people think its ugly and annoying. But for me its OK.

References

A workaround for hasOwnProperty in for-in loops

for ... in