JavaScript - 2D Arrays / Objects
<p>I am trying to create array and/ or objects to hold values for graphing. The data comes in as JSON. Each Object has an asset code a date and two measurements i am interested in. (measurement 3 with be the net of the two) I am attempting to filter by both an asset code and then the date the data was captured. I would like to compile this into a single object that I could loop through and extract data for each asset by date.  My attempt bellow was to create an array of arrays but have run into some undefined variable issues. Is there a more concise way to achieve this?</p>

<pre><code>var response = []; //to store global variables

response.handle = function handle (resp) {
    response.measurment1 = {};
    response.measurmentt2 = {};
    response.measurement3 = {};

    var dateArray = [];
    var assetCodeArray = [];

    for(object in resp) {
        if (extend.contains(dateArray,resp[object].date == false){ // extend.contains is a function that checks if an obj is in an array
            dateArray.push(resp[object].date;
        }
        if (extend.contains(dateArray,resp[object].AssetCode == false){ // extend.contains is a function that checks if an obj is in an array
            assetCodeArray.push(resp[object].date;
        }
    }
    for (var code in assetCodeArray) {
        response.injObj[assetCodeArray[code]] = [];
        response.WthObj[assetCodeArray[code]] = [];
        response.netObj[assetCodeArray[code]] = [];

        var filteredRespAC = resp.filter(function(y) {
            return y.AssetCode == assetCodeArray[code];
        });
        var AssetCodeInj = 0;
        var AssetCodeWth = 0;
        var AssetCodeNet = 0;
        for (var obj in filteredRespAC) {
            for (date in dateArray) {
                var filterACDate = filteredRespAC.filter(function(z) {
                    return z.date == dateArray[date];
                });

                var volInj = filterACDate[date]["Measurement1"];
                var volWth = filterACDate[date]["measurment2"];
                var volNet = volInj + volWth;

                response.injObj[assetCodeArray[code]].push(volInj);
                response.WthObj[assetCodeArray[code]].push(volWth);
                response.netObj[assetCodeArray[code]].push(volNet); 
    }
}
</code></pre>

<hr>

<p>A representation of JSON is as follows: </p>

<pre><code>[
    { 
        "ID" : 12345,
        "AssetCode" : "AC1",
        "Measure1" : 12345,
        "Measure2"  : -1234,
        "Date" : "2016-01-14T00:00:00"
   },{
        "ID" : 12346,
        "AssetCode" : "AC1",
        "Measure1" : 6789,
        "Measure2"  : -678,
        "Date" : "2016-01-14T00:00:00"
   },{
        "ID" : 12347,
        "AssetCode" : "AC2",
        "Measure1" : 12345,
        "Measure2"  : -1234,
        "Date" : "2016-01-14T00:00:00"
   },{
        "ID" : 12348,
        "AssetCode" : "AC1",
        "Measure1" : 12345,
        "Measure2"  : -1234,
        "Date" : "2016-01-13T00:00:00"
   }
]
</code></pre>