I have this method 'allMuseums()' that calculates the variable 'visitatori_all_musei', now I want to return this variable in such a way that every time I call the method I can give the result.
function allMuseums() {
var nomeFile = "dati_musei.csv";
var mese_anno = [];
d3.dsv(";", nomeFile, function(d) {
return {
Museo: d.Museo,
Ingresso: d.Ingresso,
Anno: d.Anno,
Mese: d.Mese,
Visitatori: d.Visitatori
}
}).then(function(data) {
var visitatori_all_musei = filtraggio(data);
});
};
For example I want to do console.log(allMuseums()) and have the result. If instead I want to assign it to a variable? For example 'var data = allMuseums()'?