I'm building a real estate market simulation running an Agent Based Model and I want to keep track of individual transactions so that I can create graphs and charts and statistic with the data. I was thinking of doing it by using a type of object that I will call Transaction:
var Transaction = function(house, askingPrice, soldPrice, daysOnMarket) {
this.date = gameDate
this.house = house
this.askingPrice = askingPrice
this.soldPrice = soldPrice
this.daysOnMarket = daysOnMarket
};
Every time there would be a transaction it would trigger the creation of a new Transaction object instance and be pushed to transArray:
transArray.push (new Transaction(house, askingPrice, soldPrice, daysOnMarket));
Is this the best way to accumulate and store this data for my stated purposes or would it be better to use a 2 dimensional array where y would be the date and x would be the house, askingPrice, soldPrice, daysOnMarket? What do you see as advantages and disadvantages for each method?
gameDatenot being defined - and I would not use a global in this case either.