function getTotal.getValues() is a server call that returns "one", "two", "three" ... "nine". i can print them with console.log(res). however, it seems i cannot push them into variable v created inside runTest Function. in this code, console.log(r) does not print anything because return v is empty. any ideas?
var test = [1,2,3,4,5,6,7,8,9];
function runTest(val) {
var v = [];
val.forEach(function(t) {
getTotal.getValues(t).then(function(res) {
//console.log(res);
v.push(res);
});
});
return v;
}
runTest(test).forEach(function(r) {
console.log(r);
});
SyntaxError: Unexpected token. The code above cannot be producing the error you're reporting.