function comm_price(comm){
list_comm = [];
k=0
var scraper = require('table-scraper');
scraper.get('http://somewebsite.com')
.then (function(tabledata){
for(i=0;i<tabledata[14].length;i++){
if(tabledata[14][i][1].includes(comm)){
list_comm[k] = (tabledata[14][i]);
k+=1;
}
}
return list_comm;
});
}
var lis = [];
lis = comm_price('Pepper');
how to assign the returned data to a variable ? Im new to javascript , since there is function inside the function , im getting pretty confused in assigning the return data to a variable.