Analyze coding challenge grades in Nexo's academic dashboard using for...of to apply bonus points, count passing students, and identify min/max scores.
JavaScriptBeginnerWith Nexo
arrays · for-of · acumuladores
Statement
Your mission
In Nexo's academic dashboard for analyzing coding challenge results, you need to process a group of students' grades: apply a general bonus capped at 100 (building a new array without altering the original) and compute the full course statistics in a single pass.
Implement the solve(input) function, which receives a JSON object with three properties:
calificaciones: array of 0 to 100 integers, each between 0 and 100.
notaAprobacion: integer between 0 and 100.
bonificacion: integer between 0 and 20.
Processing rules:
Traverse calificaciones in its original order using a for...of loop.
For each grade, calculate the adjusted grade as Math.min(100, calificacion + bonificacion) and append it to a new array calificacionesFinales (without mutating input.calificaciones).
All of the following statistics are calculated on the adjusted grades:
cantidadEstudiantes: length of calificaciones.
promedio: integer average calculated as Math.floor(suma / cantidadEstudiantes), or 0 if the array is empty.
aprobados: number of students with an adjusted grade >= notaAprobacion.
reprobados: number of students with an adjusted grade < notaAprobacion.
notaMaxima: highest adjusted grade, or null if there are no students.
notaMinima: lowest adjusted grade, or null if there are no students.
Return a JSON object with those exact seven properties: calificacionesFinales, cantidadEstudiantes, promedio, aprobados, reprobados, notaMaxima, and notaMinima.
Rules and constraints
Explicitly use a for...of loop to traverse calificaciones and build calificacionesFinales.
Using push(), length, Math.min(), Math.floor(), and simple conditionals is allowed.
Do not use map(), filter(), reduce(), sort(), Math.max(...array), Math.min(...array), recursion, classes, or helper functions.