In what way could I make the function return 3 values to me so that those 3 values would serve as input parameters for another function (as if it were a callback --which in fact, I think it is--)?
Until now, try the following (although it did not work):
var resultado;
function num_2(repet){
for (var i = 0; i > repet-1; i++) {
if (i>=1) {
return i + ", ";
}else{
return i;
}
}
}
function sumarr(a,b,c){
if (a!="" && a!=null) {
resultado = a+b+c;
return "\n" + "resul: " + resultado + '\n' + "1: " +
a + '\n' + "2: " + b + '\n' + "3: " + c + '\n' + '\n';
}else{
return "noting";
}
}
console.log("\n" + "callback 2: " + sumarr(num_2(3)));
num_2will only ever go through one iteration, because of the returns. It looks like you meant to addito an array or string, which you return later as a single variable.