The following code loops over an array. It is running within a casperJS script and therefore a phantomJS headless browser environment
socket.on('list', function(data){
console.log("Message", JSON.stringify(data)); //no func def in this data
var localMatchStore= [];
for (var i in data.matches) {
localMatchStore.push(data.matches[i]);
}
console.log(localMatchStore);
});
This returns the data I expect but also a function definition as the last item in the array. Why is this?
0580:MS101:2014,0580:MS127:2014,0580:MS128:2014,0901:LS162:2014,function () {
for(var i=0,sum=0;i<this.length;sum+=this[i++]);
return sum;
}