Why is JavaScript's For…In loop not recommended for arrays? [duplicate]
问题 This question already has an answer here: Why is using “for…in” with array iteration a bad idea? 27 answers I read somewhere (sorry, I can't find the link) that the For...In loop is not recommended for arrays. It is said here: http://www.openjs.com/articles/for_loop.php that it is meant for associative arrays, and in http://www.w3schools.com/js/js_loop_for_in.asp that is for iterating through all the properties of an object (It does not say that it can be used on arrays). I do not know who to