I'm having problems when trying to return a value encountered from a .map using Javascript. There's my code:
function LineaDeSuccion() {
const carga = vm.cargaTotal / vm.numeroEvaporadores;
vm.succion.map(i => {
if (i.temperatura == vm.tempSel) {
const cargas = Object.keys(i).map(function(key) {
return i[key];
});
// I need to return this value in my function
return getKeyByValue(i, closest(cargas, carga));
}
// Obviously I can't do it because the value it's encapsulated into the map callback.
// How can I solve it?
return value;
});
}