Skip to content

Commit 4464ff8

Browse files
#22-javascript
1 parent 8978746 commit 4464ff8

File tree

1 file changed

+1
-15
lines changed

1 file changed

+1
-15
lines changed

Roadmap/22 - FUNCIONES DE ORDEN SUPERIOR/javascript/caterinarodriguezdev.js

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -87,21 +87,7 @@ const orderEstudiantesByBirth = () => {
8787

8888
const getMayorNota = () => {
8989

90-
let mayorNota = 0;
91-
let nombreEstudiante;
92-
estudiantes.filter(estudiante => {
93-
estudiante.calificaciones.forEach(nota => {
94-
if (nota > mayorNota) {
95-
mayorNota = nota;
96-
nombreEstudiante = estudiante.nombre;
97-
}
98-
})
99-
})
100-
101-
return {
102-
nombre: nombreEstudiante,
103-
nota: mayorNota
104-
};
90+
return Math.max(...estudiantes.flatMap(estudiante => estudiante.calificaciones))
10591
}
10692

10793
getExpediente(calcularPromedio, getMejoresEstudiantes, orderEstudiantesByBirth, getMayorNota);

0 commit comments

Comments
 (0)