var i=0,len=cars.length; for (; i<len; ) { document.write(cars[i] + "<br>"); i++; }
var person={fname:"John",lname:"Doe",age:25}; for (x in person) { txt=txt + person[x]; }
第二种注意x是序号,不是对象,如果是jquery对象的话
如图length也在循环范围内,而不是0,1,2
来源:https://www.cnblogs.com/zhaogaojian/p/10796178.html