有bug,for in 循环多循环了一次.
var ab = [1, 2, 3, 4, 5, 0, a, false, -1, undefined, null, 1.324];
var b = 0;
for (var a in ab) {
b++;
}
console.log("==>"+b);
var c = 0;
for (var a = 0; a < ab.length; ++a) {
c++;
}
console.log("==>"+c);
输出:
==>13
==>12