0
How do I pick up/use the callback response here?
const arr = ["Lucas"];
function minhaCall(sobrenome, indice) {
return indice + 1 + ") " + sobrenome + " de Carvalho";
}
arr.forEach(minhaCall)
For example, I can’t give a console.log(arr.forEach(minhaCall))
how I would use the return of this function?
I don’t know if I understand very well what you meant, but you can put the
console.log
in place ofreturn
.– Caique Romero
Yes, Caique, but then it wouldn’t do me any good. For example, the.log console I can only use in the console context, but if I wanted to use this data elsewhere? I’m sorry if you’re a little confused.
– Lucas de Carvalho
It seems more like you want to make one
map
of array than aforEach
.– Woss
Relax, I think I get it now, I believe
forEach
is not the best way for it, but first solution that came to mind would be to store/increment in a variable the returns.– Caique Romero
You better say what you really want to do instead of imagining a solution and try to understand it. What you have to input and what to expect out?
– Sorack