To be IE compatible we decided to use classic for loop for arrays:
for (var i = 0; i < arr.length; ++i) { ... }
and adding obj.hasOwnProperty(key) for object for loops:
for (var key in obj) {
    if (!obj.hasOwnProperty(key)) continue;
    ...
}
But... Is this really required?
I remember that I looked in the jQuery source code and I didn't find this condition when iterating objects.
Also, if the answer is yes, is there any shorter solution than adding if(!obj.hasOwnProperty(key)) continue; to every object iterating? I mean to rewrite for somehow...
To be clear: if instead of for (var k in o) { ... } I would use:
foo (o, function (k) {
   ...    
});
function foo (o, callback) {
    for (var k in o) {
        callback (k);
    }
}
I would just add the if only one time, in foo function. But consider having a lot of object for loops. Is there any solution to rewrite for?
 
     
     
    