Basically, the problem is that you are iterating through your array using a for in
loop, which is not meant for iteratung through arrays. Its intent is to iterate through all properties of an object, and apparently there is a property called remove
on your array.
For more details on why for in
is a bad idea when it comes to arrays, see Why is using "for...in" with array iteration a bad idea?.
As solution, I'd suggest to use an indexed for
loop. This type of loop does not care about properties, hence you are fine. So it basically comes down to a very classical:
for (var i = 0; i < data.List; i++) {
console.log(data.List[i]);
}
By the way: You should not uppercase anything in JavaScript, unless it's a constructor function. Hence it should be data.list
.
PS: A nice read when it comes to arrays and (mis-)using them, read Fun with JavaScript Arrays, a quite good read.