I have the following code that inserts information into an array. For this example, I'm inserting just the index. When looking at the Chrome Console, I can see that the length of the array is correct (11) [6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16]
. However, when I expand the array, there's duplicate information and it's saying the length is 34? I am seeing the following:
(11) [6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16]
0: 6
1: 7
2: 8
3: 9
4: 10
5: 11
6: 12
7: 13
8: 14
9: 15
10: 16
11: 6 // seems to repeat itself?
12: 7
13: 8
14: 9
15: 10
16: 11
17: 12
18: 13
19: 14
20: 15
21: 16
22: 6
23: 7
24: 8
25: 9
26: 10
27: 11
28: 12
29: 13
30: 14
31: 15
32: 16
33: 17 // where is this 17 coming from?
length: 34
Does anyone know why am I seeing 34 as the length when I expand?
Code:
var html = $($(xml).find("filters").html()).find("li");
var inputs = $(html).find("input");
var types = [];
inputs.each(function(index) {
if ($(this).prop("id").indexOf("filter-types") >= 0)
{
types.push(index);
}
});
console.log(types);