Obtener las notas más altas de los estudiantes
Crea una función que recibe un array de estudiantes y devuelve un array con sus notas más altas. Si el estudiante no tiene notas, supongamos que su nota más alta es igual a 0.
Ejemplos
getStudentTopNotes([
{
id: 1,
name: "Jacek",
notes: [5, 3, 4, 2, 5, 5]
},
{
id: 2,
name: "Ewa",
notes: [2, 3, 3, 3, 2, 5]
},
{
id: 3,
name: "Zygmunt",
notes: [2, 2, 4, 4, 3, 3]
}
]) ➞ [5, 5, 4]Notas
- Intenta hacerlo con
Array.prototype.mapyArray.prototype.reduce. - Como alternativa, usa
Math.maxen lugar deArray.prototype.reduce.