This really cements the case that the poster above was stating.
no edge-case of an implementation can make its way into programmers' habits, something that tends to happen a lot with JavaScript.
There is code in the wild right now that fixes (perceived or actual) problems in the code's interaction with the V8 engine. And worse, that developer code no longer solves any problem.
whenever you have a non-local variable used as iteration variable in for-in then you most probably have a bug in your code.
Agreed, I'm pretty sure every linter would pick that up anyways. That's not really the cases that I saw though, mostly it was stuff where the key is needed in a function/closure (just threw this together straight in the text area here):
function Intercept(obj1, obj2){
for(var key in obj1){
obj2[key] = function(){
console.log('called: ', key);
obj1[key]();
}
}
}
Note that in the document I referenced, this was under section 5.1. I'm not sure if you would consider them being the same or not, but that's where it's listed in the document, so that's I how I cited it.