I want to create an array from a function. How would I go about doing this so that the array name is passed within the parameter.
function arrayCreate(name){
name = [];
}
So if I used arrayCreate("Hello") I would have Hello = [] as an array. The obvious problem is I'm passing a string so how would I overcome this.
To explain a bit more about my problem I have a function which updates a chart as seen below:
self.updateChart = function(name){
if (typeof chartData == 'undefined') {
chartData = [];
}
chartData.push({
date: game.tickCount,
visits: self.price,
});
priceLabour.validateData();
return chartData;
}
Now the "chartData = []" and "priceLabour" I would like for it to be dynamic and change based on the "name" parameter.