Hey!! 8) solo pasaba para saludar y decirle que: tendremos los encuentros los domingos, donde le subiré las practicas y ejemplos, para aumentar nuestro conocimiento. La principal idea es que estaremos para ayudarnos uno al otro, es lo que define el concepto de nodejs pequeña dosis, para no sentirnos forzado aprendiendo algo, sino aprenderlo de manera fácil y poco a poco. ::)
link:https://underc0de.org/foro/talleres-underc0de-213/taller-nodejs-en-pequena-dosis-by-dani54/ (https://underc0de.org/foro/talleres-underc0de-213/taller-nodejs-en-pequena-dosis-by-dani54/)
let misiones =[{ mision: "Acabar con thanos", id: 1}
];
let getheroe = async(id) => {
let heroeDB = heroes.find(heroe => heroe.id === id);
if (!heroeDB) {
throw new Error(`El heroe con el ID: ${id} no existe`)
} else return heroeDB;
};
let getmision = async(heroe) => {
let misionDB = misiones.find(mision => mision.id === heroe.id);
if (!misionDB) {
throw new Error(`No hay un mission para: ${heroe.nombre} `);
} else {
return {
nombre: heroe.nombre,
mision: misionDB.mision,
id: heroe.id
};
}
};
let getinfo = async(id) => {
let heroe = await getheroe(id);
let resp = await getmision(heroe);
return `La mision de ${resp.nombre} es ${resp.mision} `
}
getinfo(1).then(mensaje => console.log(mensaje))
.catch(err => console.log(err));