I have an array called ageNames. When I print it I get:
Array[12]
When you look at the elements it says:
1: "Blah" 2: "blah2" length:12 _proto_:Array[0]
However, if I say console.log(ageNames[0]) it says undefined (as it does for all elements). And if you do console.log(ageNames.length) you get a 0.
What is going on?
Relevant Code:
  var mdata = [];
  var mnames = [];
  var rowID = [];
  var ageNames = [];
  d3.json("whiskey.json", function(error, data) {
  ageNames.push(d3.keys(data[1]).filter(function(key) { return (key !== "Distillery" && key !== "RowID"); }));
data.forEach(function(d) {
    if(d["RowID"] <= 5){
        
    //console.log(mdata);
    mnames.push(d["Distillery"]);
    rowID.push(d["RowID"]);
    //console.log(d);
    mdata.push(d);
    }
    });
 console.log(ageNames);
 console.log(ageNames.length);
The first line prints Array[12] and you can look at the individual elements. The second line prints 0. How can the length be 0?
});
 
     
    