隆Te damos la bienvenida a este reto!

1

隆Bienvenido al mundo de JavaScript!

D铆a 1

2

Variables, funciones y sintaxis b谩sica

3

Tipos de datos

4

Playground - Retorna el tipo

5

Tipos de datos - pt 2

D铆a 2

6

Operadores

7

Hoisting y coerci贸n

8

Playground - Calcula la propina

9

Alcance de las variables

D铆a 3

10

Condicionales

11

Playground - Calcula a帽os bisiestos

12

Switch

13

Playground - Obten informaci贸n de mascotas seg煤n su tipo

14

Ciclos

15

Playground - Dibuja un triangulo

D铆a 4

16

Arrays

17

Playground - Encuentra al michi mas famoso

18

Objetos

19

Playground - Obten el promedio de los estudiantes

D铆a 5 - Checkpoint

20

Playground - encuentra el palindromo m谩s grande

D铆a 6

21

Reasignaci贸n y redeclaraci贸n

22

Modo estricto

D铆a 7

23

Debugging y manejo de errores

24

Programaci贸n funcional

Quiz: D铆a 7

D铆a 8

25

Closures

26

Playground - Crea una calculadora con closures

27

Higher order functions

28

Playground - Crea tu propio m茅todo map

D铆a 9

29

ECMAScript

30

TC39

Quiz: D铆a 9

D铆a 10 - Checkpoint

31

ES6

32

ES7

33

Playground - Task planner

D铆a 11

34

Asincronismo

35

Playground - Promesas

36

Manejando el asincronismo

37

Playground - Resuelve el callback hell usando promesas

38

Playground - Resuelve el callback hell usando async/await

D铆a 12

39

Arrays a profundidad

40

M茅todos de arrays: Every, Find y findIndex

41

Playground - V谩lida el formulario

D铆a 13

42

M茅todos de arrays: Includes, Join y concat

43

Playground - agrupa los productos

44

M茅todos de arrays: Flat y FlatMap

45

Playground - Encuentra la ubicaci贸n del valor buscado

D铆a 14

46

Mutable functions

47

Playground - Modifica una lista de compras

48

M茅todos de arrays: sort

49

Playground - Ordena los productos

D铆a 15 - Checkpoint

50

Playground - Sistema de reservaciones de un hotel

D铆a 16

51

Programaci贸n orientada a objetos en JavaScript

52

Objetos literales

53

Playground - Congela el objeto recursivamente

D铆a 17

54

Prototipos en JavaScript

55

Playground - Modifica el prototype de los arrays

56

Playground - Crea un auto usando clases

D铆a 18

57

Abstracci贸n en JavaScript

58

Playground - Sistema de carrito de compras

59

Encapsulamiento en JavaScript

60

Playground - Encapsula datos de los usuarios

D铆a 19

61

Herencia en JavaScript

62

Playground - Jerarqu铆a de animales

63

Polimorfismo en JavaScript

64

Playground - Sistema de pagos

D铆a 20 - Checkpoint

65

Playground - Agenda de vuelos

D铆a 21

66

Patrones de dise帽o

67

Sinlgeton & Factory pattern en JavaScript

68

Playground - Implementa singleton en un chat

D铆a 22

69

Builder & Protype pattern en JavaScript

70

Playground - Mejora el c贸digo usando builder pattern

71

Adapter & Decorator pattern en JavaScript

72

Playground - Personaliza productos de una tienda

D铆a 23

73

Facade & proxy pattern en JavaScript

74

Playground - Proxy en servicio de mensajer铆a

75

Chain of responsability & Observer pattern en JavaScript

76

Playground - Implementaci贸n de Observador en Newsletter

D铆a 24

Live Class

77

30 d铆as de JS con Juan DC

78

30 d铆as de JS con Nicobytes

No tienes acceso a esta clase

隆Contin煤a aprendiendo! 脷nete y comienza a potenciar tu carrera

Aprende todo un fin de semana sin pagar una suscripci贸n 馃敟

Aprende todo un fin de semana sin pagar una suscripci贸n 馃敟

Reg铆strate

Comienza en:

1D
3H
22M
47S

Playground - Obten el promedio de los estudiantes

19/78

Aportes 124

Preguntas 4

Ordenar por:

驴Quieres ver m谩s aportes, preguntas y respuestas de la comunidad?

o inicia sesi贸n.

馃洝锔廍scudo anti spoilers馃洝锔

.
A este punto espero ya entiendas cual es el prop贸sito de este texto, y si no, igual lo pongo para hacer espacio en este comentario (no olvides darle like).
.
Este es un comentario para aquellos y aquellas estudiantes que sea su primera vez resolviendo este coding playground y evites auto spoilearte viendo las soluciones de la comunidad (por favor SIGAN compartiendo sus soluciones, nos fascina ver como lo hacen). A su vez, este comentario tendr谩 la explicaci贸n a este problema m谩s abajo, abajo del gif random que siempre suelo poner por lo que ya sabes que esperar si haces m谩s scroll
.
Momento random del d铆a

.

Explicaci贸n

En este caso, no optamos por usar bucles. En su lugar fueron m茅todos propios de los arrays (para variar con las soluciones pero facilmente puede hacerse con un for o un while, for of, etc鈥)

export function getStudentAverage(students) {
  // Creamos un array donde obtendremos los estudiantes con su promedio
  const studentsWithAverage = students.map((student) => {
    // separamos las notas en una sola variable para hacerlo m谩s legible
    const grades = student.grades;
    // calculamos el promedio sumando todas las notas para dividirlas
    // en el total de materias
    const average =
      grades.reduce((total, item) => total + item, 0) / grades.length;

    return {
      // Retornamos un objeto con el nombre del estudiante
      name: student.name,
      // Junto con su promedio a 2 decimales
      // Es importante parsearlo con Number porque el m茅todo toFixed devuelve un string
      average: Number(average.toFixed(2)),
    };
  });

  // Despu茅s pasamos a hacer lo mismo pero obteniendo el promedio de la clase
  const classAverage =
    studentsWithAverage.reduce((total, student) => total + student.average, 0) /
    studentsWithAverage.length;
  // Sumamos todos los promedios y los dividimos entre el total de estudiantes

  // Al final armamos un objeto que ser谩 el que retornaremos
  const rta = {
    // De igual manera pasamos el promedio de la clase a 2 decimales
    classAverage: Number(classAverage.toFixed(2)),
    students: studentsWithAverage,
  };

  // Y retornamos el objeto anterior
  return rta;
}

Y 隆listo!
.
Si llegaste a esta parte de la lectura te comparto un fun fact, esta soluci贸n fue propuesta por el gran Nicobytes, mi soluci贸n era otra pero esta se ve m谩s coqueta.
.
No olvides dejar tu corazoncito

export function getStudentAverage(students) {
  // Tu c贸digo aqu铆 馃憟
  let total = 0;
  const course = {
    classAverage: 0,
    students: []
  };
  for (const student of students) {
    let sum = student.grades.reduce((sum, grade) => sum + grade);
    let averageStudent = (sum / student.grades.length).toFixed(2);
    const aStudent = {
      name: student.name,
      average: Number(averageStudent)
    }
    course.students.push(aStudent);
    total += Number(averageStudent);
  }
  course.classAverage = Number((total / students.length).toFixed(2));
  return course;
}

Por favor no m谩s loops dentro de loops, me estoy lastimando 馃槮

export function getStudentAverage(students) {
  // Tu c贸digo aqu铆 馃憟
  const studensAverageGrades = students.map(({ name, grades }) => ({
    name: name,
    average: +((grades.reduce((acc, cur) => acc += cur, 0) / grades.length).toFixed(2))
  }))

  return {
    classAverage: +(studensAverageGrades.reduce((acc, cur) => acc += cur.average,0)/studensAverageGrades.length).toFixed(2),
    students: studensAverageGrades
  }
}

Hey dude, aqui mi soluci贸n :

function getStudentAverage(students) {
  //Primero, creamos una variable totalAverage que utilizaremos para acumular los promedios individuales de cada estudiante
  let totalAverage = 0;
  //Luego, iteramos a trav茅s del array de estudiantes usando el m茅todo map() y calculamos el promedio de cada estudiante usando el m茅todo reduce().
  const studentAverages = students.map(student => {
    const average = student.grades.reduce((sum, grade) => sum + grade, 0) / student.grades.length;
    //Dentro del map(), tambi茅n agregamos el promedio del estudiante a la variable totalAverage y redondeamos el promedio a dos decimales usando el m茅todo toFixed().
    totalAverage += average;
    return {
      name: student.name,
      average: Number(average.toFixed(2))
    };
  });
  //Despu茅s de calcular los promedios individuales de cada estudiante, calculamos el promedio de la clase dividiendo totalAverage por la cantidad de estudiantes y redondeando el resultado a dos decimales.
  const classAverage = Number((totalAverage / students.length).toFixed(2));
  //Creamos el objeto de salida con los valores correspondientes y lo retornamos.
  return {
    classAverage: Number(classAverage),
    students: studentAverages
  };
}

Genial.

Aqu铆 mi soluci贸n:

export function getStudentAverage(students) {
  const final = { classAverage: 0, students: [] };
  const arrayPromedioFinal = [];
  let promedioFinal;

  for (let objeto of students) {
    const promedio = objeto["grades"].reduce((a, b) => a + b);
    arrayPromedioFinal.push(Number((promedio / objeto["grades"].length).toFixed(2)));
    promedioFinal = arrayPromedioFinal.reduce((a, b) => a + b) / students.length;
    final.classAverage = Number(promedioFinal.toFixed(2));
    final.students.push(
      {
        name: objeto.name,
        average: Number((promedio / objeto["grades"].length).toFixed(2)),
      },
    );
  };

  return final;
}

Saludos comunidad platzi lo resolv铆 de esta manera:

export function getStudentAverage(students) {
  let sumapromedios = 0;
  let promediados = students.map((student) => {
    const promedio = Number((student.grades.reduce((sum, value) => sum + value, 0) / student.grades.length).toFixed(2));
    sumapromedios += promedio;
    return { name: student.name, average: promedio, };
  })
  const nuevalista = { classAverage: Number((sumapromedios / students.length).toFixed(2)), students: promediados };
  return nuevalista;
}

Esta es mi soluciopn, aunque me esta dando error con unos decimales, es decir, en class average en mi codigo me da 88.16 pero el espera 88.17, si tienen alguna idea de como puedo corregir eso?

function getStudentAverage(students) {
    let dataStudentsAverage = {
        classAverage: 0,
        students: []
        }
        students.forEach(student => {
            const sum = student.grades.reduce((acc, currentVal) => acc + currentVal)
            const average = Number((sum / student.grades.length).toFixed(2));
            const studentAverage = { name: student.name, average }
            dataStudentsAverage.students.push(studentAverage);
            dataStudentsAverage.classAverage += Number((average / students.length).toFixed(2));            
        });        
        return dataStudentsAverage
    }
export function getStudentAverage(students) {
  var obj = {
    classAverage: 0,
    students: []
  }
  students.forEach(function (student) {
    var objStudent = {
      name: student['name'],
      average: 0
    }
    var sum = student.grades.reduce((stu, value) => stu + value)
    var resultGrade = (sum / student['grades'].length).toFixed(2);
    objStudent.average = (Number(resultGrade));
    obj.classAverage += objStudent.average;
    obj.students.push(objStudent)
  })
  var result = (obj.classAverage / students.length).toFixed(2);
  obj.classAverage = (Number(result))
  return obj;
}

Mi solucion:
.
.
.
.
.
.
.
.
.
.
.
.
.
.

export function getStudentAverage(students) {
  // Tu c贸digo aqu铆 馃憟
  let sumatoriaPromEstudiante = 0;

  let datosEstudiantes = [];

  students.forEach(estudiante => {
    let sumEstudiante = estudiante.grades.reduce((a, b) => (a + b));
    let promEstudiante = Number((sumEstudiante / estudiante.grades.length).toFixed(2));
    sumatoriaPromEstudiante += promEstudiante;
    datosEstudiantes.push({
      'name': estudiante.name,
      'average': promEstudiante
    });
  });

  let resultado = {
    'classAverage': Number((sumatoriaPromEstudiante / datosEstudiantes.length).toFixed(2)),
    'students': datosEstudiantes
  };

  return resultado;
}

// SPOILER SECTION
*
*
*
*
*
*
*
*
*
*
*
// SPOILER SECTION

Mi soluci贸n solo con lo visto hasta ahora y utilizando los m茅todos m谩s basicos posibles.

function getStudentAverage(students) {
    let classAverage = 0
    let aveStudents = []

    for (let i = 0; i < students.length; i++) {
        let sumNotas = students[i].grades.reduce((acum, val) => {
            return acum + val
        }, 0)

        let promAlum = sumNotas / students[i].grades.length
        let promAlumForm = promAlum.toFixed(2)
        let promAlumDec = parseFloat(promAlumForm)

        aveStudents.push({ name: students[i].name, average: promAlumDec })
    }

        let sumPromAlum = aveStudents.reduce((acum, val) => {
            return acum + val.average
        }, 0)

        let promClass = sumPromAlum / aveStudents.length
        let sumPromAlumForm = promClass.toFixed(2)
        classAverage = parseFloat(sumPromAlumForm)

        return {
            classAverage: classAverage,
            students: aveStudents
        }
}
export function getStudentAverage(students) {
  let total_average = 0;
  let students_average = students.map(function (student) { 
    student.average = Number((student.grades.reduce((a, b) => (a + b)) / student.grades.length).toFixed(2));
    total_average += student.average;
    return {name: student.name, average: student.average};
  })

  let class_average = Number( (total_average / students_average.length).toFixed(2));
  
  let output = {
    "classAverage": class_average,
    "students": students_average
  }
  return output;
}

export function getStudentAverage(students) {
  // Dia 4 馃挌
  const output = {
    'classAverage': 0,
    'students': []
  }

  students.forEach(student => {
    let sum = student.grades.reduce((acumulador, nota) => acumulador + nota)
    let average = sum / student.grades.length
    output['students'].push({
      'name': student.name,
      'average': parseFloat(average.toFixed(2))
    })

    output['classAverage'] += average;
  })

  output['classAverage'] = parseFloat((output.classAverage / students.length).toFixed(2))
  return output
}

function getStudentAverage(students) {
  // Tu c贸digo aqu铆 
//funcion para sumar con reduce
const sum=(acum,grade) => {
        return acum+parseFloat(grade)
      }
//funci贸n para el promedio e indicar cantidad de decimales
const avg = (sumTotal,quantity, decimal=2)=>{
    return parseFloat((sumTotal/quantity).toFixed(decimal))
}
  let averages= students.map(student => { 
    return {
      name: student.name,
      average:avg(student.grades.reduce(sum, 0), student.grades.length)
    }
  })
    return {
        classAverage:avg(averages.map(ele=>ele.average).reduce(sum, 0) , averages.length),
        students:averages
    }
}

.








function getStudentAverage(students) {
  const newStudents = [];
  let totalAverage = 0;
  let sumTotalGrades = 0;
  let sumNumberOfGrades = 0;

  for (let student of students) {
    let averagePerStudent = 0;
    let gradesOfStudent = student.grades;
    let sumAllGradesPerStudent = 0;

    for (let grade of gradesOfStudent) {
      sumAllGradesPerStudent += grade;
    }
    averagePerStudent = Number((sumAllGradesPerStudent / gradesOfStudent.length).toFixed(2));
    newStudents.push({ name: student.name, average: averagePerStudent });
    sumTotalGrades += sumAllGradesPerStudent;
    sumNumberOfGrades += gradesOfStudent.length;
  }
  totalAverage = Number((sumTotalGrades / sumNumberOfGrades).toFixed(2));
  return { classAverage: totalAverage, students: newStudents }; 
 }

me tomo 2 dias resolver la mitad, pero nada como hacerlo un mismo

function getStudentAverage(students) {
  const studentAverage = [];
  
  for (let student of students) {
    let averageScoreStudent = student.grades.reduce((accumulator, grade) =>
      accumulator + grade, 0) / student.grades.length;

    let average = Number(averageScoreStudent.toFixed(2))
    studentAverage.push({name: student.name, average: average});
  }

  const total = studentAverage.reduce((total, b) => total + b.average, 0) / studentAverage.length;

  const finalAnswer = {
    classAverage: Number(total.toFixed(2)),
    students: studentAverage,
  }

  return finalAnswer
}

Mi soluci贸n, :3

export function getStudentAverage(students) {

  let allStudents = [];
  let classGrades = 0;

  students.forEach(student => {

    let currentGradesArray = student.grades;

    // we add the grades for the current student
    let studentGrades = currentGradesArray.reduce((acc, currentValue) => acc + currentValue);

    // we get the average for the current student
    let studentAvg = parseFloat((studentGrades / currentGradesArray.length).toFixed(2));

    // we buiild the student object
    let studentObj = {
      name: student.name,
      average: studentAvg
    };

    // we add the averages of each student and push the student object
    classGrades += studentAvg;
    allStudents.push(studentObj);
  });

  // finally we get the class average
  const classAvg = parseFloat((classGrades / students.length).toFixed(2));

  // we build the result object and return it
  const result = {
    classAverage: classAvg,
    students: allStudents
  };

  return result;
}

function getStudentAverage(students) {
  let salida = [];
  let sum = 0;
  for (let student in students) {
    let av = ((students[student].grades.reduce((t, n) => t + n) / students[student].grades.length).toFixed(2)) * 1;
    sum += av;
    salida.push({ name: students[student].name, average: av });
  }
return { classAverage: Number((sum / students.length).toFixed(2)), students: salida };
}

Pos ah铆 va mi aporte, con muchos d铆as de retraso, lecturas de MDN y lugares random en Internet:

    // Tu c贸digo aqu铆 馃憟

    let averagedStudents = []; // En este arreglo ponemos los estudiantes y su promedio 
    let sumOfAverages=0; // Aqu铆 la suma de los promedios, para despu茅s sacar el promedio general
    let output = {}; // Aqu铆 voy a poner el resultado final, aunque no s茅 si output sea alg煤n tipo de palabra reservada de javascript. Espero que no :s

    // Iteraremos para sacar el promedio de cada alumno
    for (const alumn of students) {
        let averagedAlumn = {}; // Aqu铆 voy a guardar el estudiante en la iteraci贸n actual y su promedio como un objeto
        let avg = 0; // Para guardar el promedio del alumno

        // Voy a usar reduce para sumar todos los valores y luego sacar el promedio (a lo mejor se puede todo junto con otra funci贸n, pero lo desconozco)
        let sum = alumn.grades.reduce (function (acc, num) {
            return acc+num;
        },0);

        // Ahora si, sacamos el promedio
        avg = sum / alumn.grades.length;
        // Vamos a necesitar ir sumando los promedios para al final sacar el promedio general
        sumOfAverages += avg;

        // Ya tenemos todo lo que necesitamos, vamos a agregarlo al objeto averagedAlumn para despu茅s agregar ese objeto a mi arreglo de averagedStudents)
        averagedAlumn.name = alumn.name;
        averagedAlumn.average = parseFloat(avg.toFixed(2)); // Nos piden que sea n煤mero de 2 decimales, Internet dice que puedo usar parseFloat o el operador de "suma unaria" +
        averagedStudents.push(averagedAlumn); 
    }
    
    // Ahora, a mi objeto de salida 
    output.classAverage = parseFloat(((sumOfAverages/students.length).toFixed(2))) // Me parece incre铆ble que en javascript se pueda esto
    output.students = averagedStudents;

    // Retornamos el objeto de salida
    return output;

De seguro no es la mejor manera, pero funciona

export function getStudentAverage(students) {
    const ClassNotes = {
        students: [],
        classAverage: 0
    };
    for (const student of students) {
        const nombreEstudiante = student.name,
            notasEstudiante = student.grades;
        let tpm = 0, nota = 0;
        for (nota of notasEstudiante) { nota = nota + tpm; tpm = nota; };
        nota = nota / student.grades.length;
        ClassNotes.students.push({ name: nombreEstudiante, average: Number(nota.toFixed(2)), });
    };
    let promedioTotal = 0, tpm = 0;
    for (let i = 0; i < ClassNotes.students.length; i++) { 
        let nota = ClassNotes.students[i].average; 
        promedioTotal = nota + tpm; tpm = promedioTotal; 
    }
    ClassNotes.classAverage =  Number ((promedioTotal / ClassNotes.students.length).toFixed(2));

    return ClassNotes;
}; 

Esta es mi solucion

const resultStudents ={
        classAverage: 0,
        students:[]
    }
    students.map(student=>{

        let promedioEstudiante=student.grades.reduce((anterior,actual)=>{
            return anterior+actual
        },0)

        promedioEstudiante=promedioEstudiante/student.grades.length
        
        resultStudents.students.push({
            name:student.name,
            average:parseFloat(promedioEstudiante.toFixed(2))
        })
        
        resultStudents.classAverage=resultStudents.classAverage+promedioEstudiante
    })
    resultStudents.classAverage=parseFloat(((resultStudents.classAverage)/resultStudents.students.length).toFixed(2))

    return resultStudents

MI SOLUCI脫N
MI SOLUCI脫N
MI SOLUCI脫N
.
.
.
.
.
Utilizando los m茅todos map y reduce.

export function getStudentAverage(students) {
    const amountStudents = students.length;
	  let sumGradesAverage = 0;
	
	  const studentsAverages = students.map(student => {
	    const amount = student.grades.length;
	    const averageGrades = student.grades.reduce((acum, num) => acum + num) / amount;
	    sumGradesAverage += averageGrades;
	    return { name: student.name, average: parseFloat(averageGrades.toFixed(2)) };
	  });
	  const totalAverage = parseFloat((sumGradesAverage / amountStudents).toFixed(2));
	
	  return { classAverage: totalAverage, students: studentsAverages };
}
export function getStudentAverage(students) {
  // Tu c贸digo aqu铆 馃憟
  let classSum = 0;
  let newStudents = [];
  let studentsAverage = students.map(function(student) {
    let sum = 0;
    student.grades.forEach(function (grade) {
      sum += grade;
    });
    let average = sum / student.grades.length;
    const newStudent = {
      name: student.name,
      average: Number(average.toFixed(2)),
    };
    classSum += newStudent.average;
    return newStudent;
  });

  let classAverage = classSum / studentsAverage.length;
  newStudents = {
    classAverage: Number(classAverage.toFixed(2)),
    students: studentsAverage
  }
  console.log(newStudents);
  return newStudents

}

Mi soluci贸n:

function getStudentAverage(students) {
  const averages = {
    classAverage: null,
    students: []
  }
  students.forEach(student => {
    averages.students.push({
      name: student.name,
      average: Number((student.grades.reduce((a, b) => a + b) / student.grades.length).toFixed(2))
    })
  })
  averages.students.forEach(student => averages.classAverage += student.average);
  averages.classAverage = Number((averages.classAverage / averages.students.length).toFixed(2));
  return averages;
}

Mi soluci贸n 馃
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

const getAverage = (values, length) => {
  const sum = values.reduce((a, b) => a + b);
  const avg = (sum / length).toFixed(2);

  return parseFloat(avg);
};

const getStudentAverage = (students) => {
  const solutionAverage = {};
  const notesStudents = [];
  const totalStudents = students.length;

  const studentsAverage = students.map((element) => {
    const studentAverage = getAverage(element.grades, element.grades.length);

    return {
      name: element.name,
      average: studentAverage,
    };
  });

  studentsAverage.map((element) => notesStudents.push(element.average));

  const classAverageSolution = getAverage(notesStudents, totalStudents);

  solutionAverage["classAverage"] = classAverageSolution;
  solutionAverage["students"] = studentsAverage;

  return solutionAverage;
};

Reduce llamando a otro reduce, just awesome! 馃槂

 function getStudentAverage(students) {
  // Tu c贸digo aqu铆 馃憟
  const ave = students.reduce((acc, current) => {
    console.log("馃殌 ~ acc ", acc);
    let avecurrent = current.grades.reduce((acc, current) => {

      return acc + current;
    }, 0);


    return {
      ...acc,
      classAverage: (acc.classAverage + (avecurrent / current.grades.length)),
      students: [
        ...acc.students,
        {
          name: current.name,
          average: Number((avecurrent / current.grades.length).toFixed(2)),
        }]

    }
  }, { classAverage: 0, students: [] });

  return {
    ...ave,
    classAverage: Number((ave.classAverage / students.length).toFixed(2)),
  }
};

export function getStudentAverage(students) { 
  const average = {
    classAverage: 0,
    students: [],
  };

  const u = students.map((e) => {
    const promedioDecimal = e.grades.reduce((a, b) => a + b) / e.grades.length;
    const promedio = parseFloat(promedioDecimal.toFixed(2));
    average.students.push({ name: e.name, average: promedio });
    return promedioDecimal;
  });

  const promedioGrupoDecimal = u.reduce((va, nv) => va + nv) / students.length
  const promedioGrupo = Number(promedioGrupoDecimal.toFixed(2));
  average.classAverage = promedioGrupo;

  return average;
}

Estimada comunidad, aqu铆 les comparto mi soluci贸n desde luego que puede ser optimizada.

Saludos Cordiales

export function getStudentAverage(students) {
  // Tu c贸digo aqu铆 馃憟
  let sumaNotasClase = 0;
  let studentAverage = 0;
  let studentVector = [];
  let classAverage = 0;

  for (let i = 0; i < students.length; i++) {
    studentAverage = (students[i].grades.reduce(function (acumulado, nota) {
      return acumulado + nota;
    }, 0)) / students[i].grades.length;
    sumaNotasClase = sumaNotasClase + studentAverage;
  }

  classAverage = parseFloat((sumaNotasClase / students.length).toFixed(2));

  studentVector = students.map(function (student) {
    return {
      name: student.name,
      average: parseFloat(((student.grades.reduce(function (acumulado, nota) {
        return acumulado + nota;
      }, 0)) / student.grades.length).toFixed(2))
    };
  });

  let respuesta = {
    classAverage: classAverage,
    students: studentVector
  }

  return respuesta;
}

My solution

let result = {
                classAverage: 0,
                students: [],
            }


            for (let i = 0; i <= students.length - 1; i++) {
             
                let students1 = { name: 0, grades: 0 };

                let sumaNotas = students[i].grades.reduce(
                    (acum, currentVal) => acum + currentVal,
                    0
                );
                // console.log(students.length)
                //console.log(promedioI)

                let promedioI = parseInt(((sumaNotas / students[i].grades.length).toFixed(1)));

                students1.grades=promedioI;
                students1.name = students[i].name;

                result.students.push(students1);
               // console.log(promedioI)

            }
            let promedioGeneral=0;
            for(let j=0;j<=result.students.length -1;j++){
                
                promedioGeneral += result.students[j].grades;

                result.classAverage=parseInt((promedioGeneral/result.students.length).toFixed(1));
               // console.log(promedioGeneral);
            }


            return result;

Soluci贸n

function getStudentAverage(students) {
  // Tu c贸digo aqu铆 馃憟
  const group = {
  	classAverage: 0,
    students: []
  }
  
 	for (let student of students) {
  
    let studentSum = student.grades.reduce((acc, cur) => acc+cur, 0)
    let studentAverage = studentSum / student.grades.length
    studentAverage = Number.parseFloat(studentAverage.toFixed(2))
    group.classAverage += studentAverage
    group.students.push({name: student.name, average: studentAverage})
  }
 
 	group.classAverage = Number
  	.parseFloat((group.classAverage / group.students.length).toFixed(2))
  
 	console.log(group)
}

Mi soluci贸n ser铆a:
.
.
.
.
.
.
.
.
.
.

<script>
function getStudentAverage(students) {
  let averages = students.map((student) => {
    return {
      name: student.name,
      average:
        Math.round(
          student.grades.reduce(
            (average, grade) => (average += grade / student.grades.length),
            0
          ) * 100
        ) / 100,
    };
  });
  return {
    classAverage:
      Math.round(
        averages.reduce(
          (total, student) => (total += student.average / averages.length),
          0
        ) * 100
      ) / 100,
    students: averages,
  };
}
</script>

Mi Soluci贸n

export function getStudentAverage(students) {
  const studentsAverage = students.map(student => ({ name: student.name, average: +(student.grades.reduce((acc, cur) => acc + cur, 0) / student.grades.length).toFixed(2) }))

  const classAverage = +(studentsAverage.reduce((acc, cur) => acc + cur.average, 0) / studentsAverage.length).toFixed(2)

  return {classAverage, students: studentsAverage}
}
const average = (quantity, div) => Math.round(quantity / div * 100) / 100;

export const getStudentAverage = (students) => {
  let classAverage = 0;
  for (let i = 0; i < students.length; i++) {
    students[i].average = students[i].grades.reduce((acc, curr) => acc + curr, 0);
    students[i].average = average(students[i].average, students[i].grades.length);
    delete students[i].grades;

    classAverage += students[i].average;
  }
  classAverage = average(classAverage, students.length);
  return { classAverage, students }
}
export function getStudentAverage(students) {
  // Tu c贸digo aqu铆 馃憟
  let averageGrads = {};
  averageGrads.students = [];
  let totalAvgPoints = 0;

  for (let student of students) {
    let avgStudent = student.grades.reduce((a, b) => a + b) / student.grades.length;
    averageGrads.students.push({ name: student.name, average: Number(avgStudent.toFixed(2)) });
    totalAvgPoints += avgStudent;
  }

  let classAverage = totalAvgPoints / students.length;
  classAverage = Number(classAverage.toFixed(2));
  averageGrads = { classAverage: classAverage, ...averageGrads };

  return averageGrads;
}

Estimados comparto esta info que me ayudo a entender mejor una excelente herramienta https://www.freecodecamp.org/espanol/news/javascript-map-como-utilizar-la-funcion-js-map-metodo-de-arreglo/

export function getStudentAverage(students) {
  // Tu c贸digo aqu铆 馃憟
  let grados = []
  let names = []
  let studentChange = []
  grados.push(students.map(element => element.grades))
  names.push(students.map(element => element.name))
  let aver = []
  for (let i = 0; i < grados[0].length; i++) {
    aver.push(Number((grados[0][i].reduce((partialSum, a) => (partialSum + a), 0) / grados[0][i].length).toFixed(2)))
    studentChange.push({
      name: names[0][i],
      average: aver[i]
    })

  }
  let promedio = (Number((aver.reduce((partialSum, a) => (partialSum + a), 0) / aver.length).toFixed(2)))

  return ({
    classAverage: promedio,
    students: studentChange
  })
}

comparto mi c贸digo

export function getStudentAverage(students) {
    /* Creamos un array donde obtendremos los estudiantes con su promedio, pero me apoyo de 
    los mapas para
    Obtengo el total de la suma de todas las calificaciones de cada alumnp
    */
    const estudiantesConPromedio = students.map((student) => {
        //paso el valor de la calificacion de cada estudiante a una variable para poder leer individualmente
        //lo puse en un arreglo llamado grades
        const califAlumno = student.grades;
        //ahora calculo el promedio de todas las calificaciones y las divido entre el tama帽o del arreglo grades
        const promAlumno = califAlumno.reduce((sumaPromedios, item) => sumaPromedios + item, 0) / califAlumno.length;
        //ahora retorno un objeto con el valor de las calificaciones
        return { //primeramente paso el valor del nombre tomando el array que me llega
            name: student.name,
            //ahora guardo su promedio truncando a dos decimales
            average: Number(promAlumno.toFixed(2)),
        };
    });
    //ahora obtengo el promedio general, sumando todos los promedios y los divido entre el total de registros
    const classAverage = estudiantesConPromedio.reduce((total, student) => total + student.average, 0) / estudiantesConPromedio.length;
    //convierto el promedio de la clase a dos decimales
    const califFinales = {
        classAverage: Number(classAverage.toFixed(2)),
        students: estudiantesConPromedio,
    };
    //retorno el objeto que tiene los alumnos y sus promedios
    return califFinales;
}

.
.
.

.
.
.
.
.
.
.
.
.

export function getStudentAverage(students) {
  // Tu c贸digo aqu铆 馃憟
  const studentsAverages = [];
  students.forEach(
    (student) => {
      const gradesArr = student.grades;
      let gradesAVG = gradesArr.reduce(function (sum, value) {
        return sum + value;
      }, 0) / gradesArr.length;
      gradesAVG = Number(gradesAVG.toFixed(2));
      studentsAverages.push(
        {
          name:     student.name,
          average:  gradesAVG
        }
      );
    }
  );
  let classAverage = studentsAverages.reduce(function (sum, student) {
    return sum + student.average;
  }, 0) / studentsAverages.length;
  classAverage = Number(classAverage.toFixed(2));
  return {
    classAverage: classAverage,
    students:     studentsAverages
  }
}

Me encantan los playgrounds hagan m谩s que solo 30 d铆as please.

export function getStudentAverage(students) {
  // Tu c贸digo aqu铆 馃憟
  let meanStudents = {};
  let prom = 0
  let studentsList = [];
  // Object logical construct
  for (let student of students) {
    let promPerStudent = student.grades.reduce((value, value2) => value + value2) / student.grades.length;
    studentsList.push({ name: student.name, average: Number(promPerStudent.toFixed(2)) });
    prom += promPerStudent;
  }
  // add to Object classAverage and studentsList properties
  prom = (prom / students.length).toFixed(2);
  meanStudents["classAverage"] = Number(prom);
  meanStudents["students"] = studentsList;
  return meanStudents;
}

Les comparto mi soluci贸n:

pero antes:

Gente mi solucion
.
.
.
.
.
.
.
.
.

.
.

export function getStudentAverage(students) {
  // Tu c贸digo aqu铆 馃憟
  
  let resultAvg = students.map(function (student) {
    return {
      name: student.name,
      average: Number(((student.grades.reduce((a, b) => a + b, 0)) / student.grades.length).toFixed(2))
    }
  });
  let suma = 0;
  resultAvg.forEach(function (stu) { 
    suma += stu.average;
  });
  return {
    classAverage: Number((suma / resultAvg.length).toFixed(2)),
    students: resultAvg
  };
}

.
.
.
.
.
.
.

export function getStudentAverage(students) {
  // Tu c贸digo aqu铆 馃憟
  let response = {
    classAverage: 0,
    students: []

  };
  response.students = students.map(
    student => {
      let avg = Number.parseFloat((student.grades.reduce((a, b) => a + b) / student.grades.length).toFixed(2));
      response.classAverage += avg;
      return {
        name: student.name, average: avg
      }
    });


  response.classAverage /= response.students.length;
  response.classAverage = Number.parseFloat(response.classAverage.toFixed(2))
  return response;  
}

Listo, esta es mi soluci贸n

.
.
.
.
.
.
.
.
.
.
.
.

export function getStudentAverage(students) {
  let averages = { classAverage: 0, students: [] };
  students.forEach((student) => {
    let average =
      student.grades.reduce(function (average, qualification, index) {
        return average + qualification;
      }) / student.grades.length;
    averages.students.push({
      name: student.name,
      average: parseFloat(average.toFixed(2))
    });
    averages.classAverage += average;
  });

  averages.classAverage = parseFloat((averages.classAverage / students.length).toFixed(2));

  return averages;
}

Cordial saludo socializo mi soluci贸n ante el ejercicio. Muchas gracias.

function getStudentAverage(students) {
  let average;

  let averageStudents = {
    classAverage: 0,
    students: [],
  };

  //calcular promedio de cada estudiante.
  for (const student of students) {
    let total = student.grades.reduce((accumulator, grades) => {
      return accumulator + grades;
    }, 0);

    average = total / 4;

    //suma promedio de cada estudiante
    averageStudents.classAverage += average;

    //registro estudiantes arreglo estudiantes objeto -> averageStudents
    averageStudents.students.push({ name: student.name, average: average });
  }

  //calculo promedio total de la clase
  averageStudents.classAverage /= students.length;

  //console.log(averageStudents.classAverage.toFixed(2));

  // impresion resultados

  console.log(`classAverage: ${averageStudents.classAverage.toFixed(2)}`);
  for (const student of averageStudents.students) {
    console.log(student);
  }
}

getStudentAverage(students = [
    {
      name: "Pedro",
      grades: [90, 87, 88, 90],
    },
    {
      name: "Jose",
      grades: [99, 71, 88, 96],
    },
    {
      name: "Maria",
      grades: [92, 81, 80, 96],
    },
  ]
);

export function getStudentAverage(students) {
  var gradesClass = {
    classAverage: 0,
    students: []
  }

  let averageTotal = 0;  
  for (let student of students) {
    let average = Number((student.grades.reduce(function (acumulate, grade) {
      return acumulate + grade
    }) / student.grades.length).toFixed(2)); 

    averageTotal = averageTotal + average;

    gradesClass.students.push({ name: student.name, average: average });
  }

  gradesClass.classAverage = Number((averageTotal/students.length).toFixed(2));

  return gradesClass;
}
export function getStudentAverage(students) {
  // Tu c贸digo aqu铆 馃憟
  const studentsWithAverage = students.map((student) => {
    const sumGrades = student.grades.reduce((average, currentValue) => average + currentValue, 0);
    const average = sumGrades / student.grades.length;

    return {
      name: student.name,
      average: Number(average.toFixed(2)),
    }
  });

  const sumAverages = studentsWithAverage.reduce((average, currentStudent) => average + currentStudent.average, 0);
  const classAverage = sumAverages / studentsWithAverage.length;

  return {
    classAverage: Number(classAverage.toFixed(2)),
    students: studentsWithAverage
  }
}
export function getStudentAverage(students) {

  let student = students.map((elemet) => {
    return {
      name: elemet.name,
      average: Number(((elemet.grades.reduce((a, b) => a + b)) / elemet.grades.length).toFixed(2))
    }
  })

  let classAverageArray = student.map((elemet) => elemet.average).reduce((a,b)=> a + b) 
  let classAverageMat = Number((classAverageArray / student.length).toFixed(2))

 
  const obj = {
    classAverage: classAverageMat,
    students: student
  }

 
  return obj
}

Hola. Mi soluci贸n comentada
.
.
.
.
.
.
.
.
.
.
.

export function getStudentAverage(students) {
  /* objeto de acumulaci贸n*/
  let ans = { classAverage: 0, students: [] }
  /* recorrido sobre arreglo*/
  students.forEach(s => {
    /* obtenci贸n de nombre */
    let name = s.name
    /* obtenci贸n de avr haciendo suma con reduce y dividiento entre el total de valores en el arreglo */
    let avr = s.grades.reduce((a, b) => a + b) / s.grades.length
    /* acumulaci贸n de avr con un promedio fraccionado */
    ans.classAverage += avr / students.length
    /* adici贸n de data al array2 con truncamiento de decimales */
    ans.students.push({ name:name, average: parseFloat(avr.toFixed(2)) })
  })
  /* truncamiento de decimales al atributo cA */
  ans.classAverage = parseFloat(ans.classAverage.toFixed(2))
  /* return */
  return ans
}

++
+
+
+
+
+
+
+
+

export function getStudentAverage(students) {
    let promedio={
        classAverage:0,
        students:[]
    }
    let promedios=[];
    for(const [key, value] of Object.entries(students)){
        let prom= parseFloat((value.grades.reduce((acc, item) => {
          return acc = acc + item;
        })/value.grades.length).toFixed(2));
        promedios.push(prom)
        let objeto = {
          name:value.name,
          average:prom
        };
        promedio.students.push(objeto);
      }
    promedio.classAverage=parseFloat((promedios.reduce((acc, item) => {
      return acc = acc + item;}) / promedios.length).toFixed(2));
    return promedio; 
}

(*锞夆柦锞)

export function getStudentAverage(students) {

  let classAndStudentAverage = {}
  let sumClassGrades = 0
  let countClassGrades = 0
  let studentList = []

  students.forEach(s => {

    let sumStudentGrades = s.grades.reduce((n, c) => (n + c))

    let student = {
      name: s.name,
      average: parseFloat((sumStudentGrades / s.grades.length).toFixed(2))
    }

    sumClassGrades += sumStudentGrades
    countClassGrades += s.grades.length

    studentList.push(student)

  })

  classAndStudentAverage = {
    classAverage: parseFloat((sumClassGrades / countClassGrades).toFixed(2)),
    students: studentList
  }

  return classAndStudentAverage

}

Por aqu铆 dejo mi aporte:

export function getStudentAverage(students) {
  // Tu c贸digo aqu铆 馃憟
  // Tu c贸digo aqu铆 馃憟
  let promGral = 0;
  let lngGral = students.length;
  for (let i = 0; i < students.length; i++) {
    let promStudent = students[i].grades.reduce(function (a, b) {
      return a + b;
    }, 0);
    let lngGrade = students[i].grades.length;
    let total = promStudent / lngGrade
    students[i].grades = parseFloat(total.toFixed(2));
    promGral += students[i].grades;
  }

  promGral = promGral / lngGral;
  let newArr = students.map(({ grades, name }) => ({
    average: grades,
    name: name
  }))
  const result = {
    classAverage: parseFloat(promGral.toFixed(2)),
    students: newArr
  }

  return result;
}

Mi soluci贸n 馃く:

export function getStudentAverage(students) {
  const studentsResult = students.reduce(
    (_prev, _current) => {
      const average = (
        _current.grades.reduce((prev, curr) => prev + curr, 0) / _current.grades.length
      ).toFixed(2);

      return {
        classGrade: Number(_prev.classGrade) + Number(average),
        students: [
          ..._prev.students,
          {
            name: _current.name,
            average: Number(average),
          },
        ],
      };
    },
    {
      classGrade: 0,
      students: [],
    }
  );

  const averageClass = (studentsResult.classGrade / students.length).toFixed(2);

  return {
    classAverage: Number(averageClass),
    students: studentsResult.students,
  };
}

馃洝锔廠in spoilers馃洝锔
Mi soluci贸n: con un forEach y un reduce.

export function getStudentAverage(students) {
  let studentsResponse = [];
  let classAverage = 0;


  students.forEach((student) => {
    const average = student.grades.reduce((a, b) => a + b, 0) / student.grades.length;

    const studentResponse = {
      name: student.name,
      average: Number(average.toFixed(2)),
    }

    classAverage += average;
    studentsResponse.push(studentResponse);
  });

  classAverage = classAverage / students.length;
  classAverage = Number(classAverage.toFixed(2));

  return {
    classAverage,
    students: studentsResponse,
  };
} 

Esta es mi soluci贸n
+
+
+
+
+
+
+
+

function getStudentAverage(students) {

    const averageStudents = students.map(item => 
        {
            return {
                name: item.name,
                average: parseFloat(((item.grades.reduce((a,c)=>  a + c, 0)) / item.grades.length).toFixed(2))
            }
      
    });

         
        return {
            classAverage: parseFloat(((averageStudents.reduce((a, c) =>  a + c.average, 0 )) / averageStudents.length).toFixed(2)),
            students: [...averageStudents]
        };

  };

Mi soluci贸n:

export function getStudentAverage(students) {
  let classAverage = 0
  let studentsAverage = []

  for (let i = 0; i < students.length; i++) {
    let average = 0
    for (let grade of students[i].grades) {
      average += grade / students[i].grades.length
    }
    let student = {
      name: students[i].name,
      average: Number(average.toFixed(2))
    }
    studentsAverage.push(student)
    classAverage += average / students.length
  }
  let averages = {
    classAverage: Number(classAverage.toFixed(2)),
    students: studentsAverage
  }
  return averages
}


.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

export function getStudentAverage(students) {
  var sumaclase = 0

  let resultado = {
    classAverage: 0,
    students: []
  }

  for ( let estudiante of students) {
      
      let arreglo = {
        name: estudiante.name,
        average: 0
      }

      let calculo = (estudiante.grades.reduce((accumulator, currentValue) => accumulator + currentValue, 0)) / estudiante.grades.length

      let promedio = parseFloat(calculo.toFixed(2));
      arreglo.average = promedio;
    resultado.students.push(arreglo);

      sumaclase+= promedio
      
  }

  let calculopromediogeneral = sumaclase / resultado.students.length

  resultado.classAverage = parseFloat(calculopromediogeneral.toFixed(2))

  return (resultado)
   
 }

.
.
.
.
.
.
.
.
.
.
.
.
.

  function getStudentAverage(students) {
    let studentsProm = []
    let sumaTotal = 0

    // Recorremos cada estudiante reducir el arreglo y retornar el promedio
    students.forEach(element => {
        let prom = element.grades.reduce(function(acum, num) {
            return acum + num
        }, 0)/element.grades.length

        sumaTotal += prom

        studentsProm.push({'name': element.name, 'average': prom})
    })
    let salida = {'classAverage': 0, 'students': studentsProm}
    salida.classAverage = (sumaTotal / students.length).toFixed(2)

    //console.log(salida);
    return salida
  }

Soluci贸n鈥 馃槃
.
No es la soluci贸n m谩s optima鈥 para nada 馃槀. Pero a modo de practicar arrays y sus m茅todos.
.

export function getStudentAverage(students) {
  //Array de estudiantes con promedio
  let studentsWA = [];

  //Creamos nuevos estudiantes con promedio
  let averages = students.map((average) => {
    let n = average.grades.length; //Cantidad de notas
    //Acumulamos las notas para cada estudiante
    let avrs = average.grades.reduce((acc, avr) => {
      return acc + avr;
    }, 0);

    let newStudentWA = {
      name: average.name,
      average: Number((avrs / n).toFixed(2))
    };

    //A帽adimos al array de estudiantes con promedio 
    studentsWA.push(newStudentWA);
  });

  //cantidad de estudiantes
  let nStudents = studentsWA.length;

  //Acumulamos las notas de todos los estudiantes
  let classAverage = [...studentsWA].reduce((acc, avr) => {
    return acc + avr.average;
  }, 0);

  /* Creamos el objeto resultado con el promedio
   de todos los estudiantes y los estudiantes con promedio */
  let result = {
    classAverage: Number((classAverage / nStudents).toFixed(2)),
    students: studentsWA
  };

  //Retornamos el resultado
  return result;
}

Mi humilde soluci贸n solo usando lo aprendido, sin nada que no hemos visto.

export function getStudentAverage(students) {
  var promedio = 0;
  var promediogrupal = 0;
  var suma = 0;
  var personalaverage = [];
  for (const prop in students) {
    suma = 0;
    for (const element of students[prop].grades) { suma += element; }
    promedio = suma / students[prop].grades.length;
    promediogrupal += promedio;
    personalaverage.push({ name: students[prop].name, average: Number(promedio = promedio.toFixed(2)) });
  }
  promediogrupal /= students.length;
  return { classAverage: Number(promediogrupal.toFixed(2)), students: personalaverage };
}

Mi solu

export function getStudentAverage(students) {
  const averages = {
    classAverage: 0,
    students: []
  }
  let gradesRegister = []

  for (let currentStudent in students) {
    let student = students[currentStudent]
    let averageGrade = student.grades.reduce((a, b) => a + b, 0) / student.grades.length
    averages.students.push({ 'name': student.name, 'average': Number(averageGrade.toFixed(2)) })
    gradesRegister.push(student.grades)
  }
  const classAverage = gradesRegister.flat().reduce((a, b) => a + b, 0) / gradesRegister.flat().length
  averages.classAverage = Number(classAverage.toFixed(2))
  return averages 
}

Spoilers:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Mi soluci贸n:

export function getStudentAverage(students) {
  const result = {
    classAverage: 0,
    students: []
  }
  for (let student of students) {
    let average = 0;
    for (let grade of student.grades) {
      average = average + grade;
    }
    average = average / student.grades.length;
    average = Number(average.toFixed(2));
    result.students.push({ name: student.name, average: average });
  }

  let classAverage = 0;
  for (let student of result.students) {
    classAverage = classAverage + student.average;
  }
  classAverage = classAverage / result.students.length;
  classAverage = Number(classAverage.toFixed(2));
  result.classAverage = classAverage;
  return result;
}

Buenas comparto mi solucion
*
*
*
*
*
*
*
*
*

function getStudentAverage(students) {
  const newStudents = students.map((student) => {
    let totalGrades = student.grades.reduce((acum, grade) => acum + grade, 0)
    let average = Number((totalGrades / student.grades.length).toFixed(2))

    return {
      name: student.name,
      average
    }
  })

  const totalGrades = newStudents.reduce((acum, student) => acum + student.average, 0)
  const classAverage = Number((totalGrades / students.length).toFixed(2))

  return {
    classAverage,
    students: newStudents
  }
}
export function getStudentAverage(students) {
  let new_obj = {}
  let promedio_general = 0
  let estudiantes= []

  students.forEach((student) => {
    let promedio_estudiante = (student.grades.reduce((a, b) => a + b)) / student.grades.length
    promedio_general += promedio_estudiante / students.length
    estudiantes.push({ name: student.name, average: parseFloat(promedio_estudiante.toFixed(2)) })
  })
  new_obj['classAverage'] = parseFloat(promedio_general.toFixed(2))
  new_obj['students'] = estudiantes
  return new_obj
}

Hasta que lo resolvi, casi todo el dia pero lo hice:
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

export function getStudentAverage(students) {
  // Tu c贸digo aqu铆 馃憟
  let sumAverageClass = 0;
  const averClass = [];
  for (const student in students) {
    const sumAverage = students[student].grades.reduce((grade, sum) => (grade + sum));
    sumAverageClass += (sumAverage / students[student].grades.length);
    averClass.push({ name: students[student].name, average: Number((sumAverage / students[student].grades.length).toFixed(2)) });
  }
  return { classAverage: Number((sumAverageClass / averClass.length).toFixed(2)), students: averClass };
}

Les comparto mi soluci贸n al reto:

function getClassAverage(students) {

  //Esta funcion interna calcula el promedio de cada estudiante y se devuleve un array de objetos con el
  //nombre y promedio de cada estudiante
  const getStudentAverage = (students) => {
    const studentAverage = [];
  
    for (let student of students) {
      const draftAverage = student.grades.reduce((acc, sum) => acc + sum, 0)/student.grades.length;
      const average = Number.parseFloat(draftAverage.toFixed(2));
      studentAverage.push({'name': student.name, 'average': average});
    }
    
    return studentAverage;
  }

  //Aqui sumamos cada promedio individual y despues sacamos el promedio general de la clase
  let classAverage = 0;
  const studentData = getStudentAverage(students);
  for(let student of studentData) {
    classAverage += student.average;
  }
  classAverage = classAverage/studentData.length;
  const generalAverage = Number.parseFloat(classAverage.toFixed(2));

  console.log(typeof generalAverage)

  //Devolvemos un objeto con el promedio general de la clase y con un array que tiene en objetos los datos
  //nombre y promedio de cada estudiante
  return {
    'classAverage': generalAverage,
    'students': studentData,
  }
}

Comparto mi soluci贸n

const sumValues = (accum, value) => accum + value;
const getAverage = (arr) => parseFloat((arr.reduce(sumValues, 0) / arr.length).toFixed(2));

export function getStudentAverage(students) {
  // Tu c贸digo aqu铆 馃憟
  let classAverage = 0;

  const average = students.map((student) => {
    const studentAv = getAverage(student.grades);
    classAverage += studentAv / students.length;
    return {
      name: student.name,
      average: studentAv
    }
  }
  );
  
  return {
    classAverage: parseFloat(classAverage.toFixed(2)),
    students: average 
  }
  
}

馃洝锔廍scudo anti spoilers馃洝锔
馃洝锔 Aqu铆 mi soluci贸n al playground:
馃洝锔
馃洝锔
馃洝锔
馃洝锔
馃洝锔
馃洝锔
馃洝锔
馃洝锔
馃洝锔
馃洝锔
馃洝锔
馃洝锔
馃洝锔
馃洝锔
馃洝锔
馃洝锔
馃洝锔
馃洝锔
馃洝锔
馃洝锔
馃洝锔

export function getStudentAverage(students) {
  let res = {
    classAverage: 0,
    students: []
  }

  students.forEach(s => {
    let average = 0;
    average = s.grades.reduce((acc, g) => acc + g, 0) / s.grades.length;
    average = Number(average.toFixed(2))
    res.students.push({ name: s.name, average })
    res.classAverage += average
  });
  res.classAverage = res.classAverage / res.students.length;
  res.classAverage = Number(res.classAverage.toFixed(2))
  return res
}

Lo logre 馃構

export function getStudentAverage(students) {
  let objeto = {
    classAverage: 0,
    students : []
  };
  let promedios = [];
  const promedio = (array) => parseFloat((array.reduce((a, b) => a + b, 0) / array.length).toFixed(2));

  for (let student of students) {
    promedios.push(promedio(student.grades));
    objeto.students.push({ name: student.name, average: promedio(student.grades)});
  }
  objeto.classAverage = promedio(promedios);

  return objeto;

}

Mi soluci贸n compa帽eros, tambien se puede user parseFloat para transforma un string a un numero de punto flotante.

export function getStudentAverage(students) {
  // Tu c贸digo aqu铆 馃憟
  let total = 0;

  const response = students.map(item => {
    const sum = item.grades.reduce((ac, current) => (ac + current), 0);


    const average = sum / item.grades.length
    total += average;

    return {
      name: item.name,
      average: parseFloat(average.toFixed(2))
    }
  })

  const classAverage = total / students.length;

  return {
    classAverage: parseFloat(classAverage.toFixed(2)),
    students: response
  }
}

Muchos errores de tipeo tuve!!! ya voy a ir mejorando eso con la pr谩ctica. Ac谩 va mi soluci贸n
.
.
.
.
.
.
.
.
.

export function getStudentAverage(students) {
  // Tu c贸digo aqu铆 馃憟
  let accumulateGrades = 0;
  let classAverage;
  let studentsx = [];
  students.forEach(student => {
    let studentAverage = student.grades.reduce((acc, valor) => acc + valor, 0) / student.grades.length;
    studentsx.push({ name: student.name, average: Number(studentAverage.toFixed(2))})
  })
  studentsx.forEach(student => {
    accumulateGrades += student.average;
  })
  classAverage = parseFloat((accumulateGrades / studentsx.length).toFixed(2))
  return {classAverage: classAverage, students: studentsx}
}

Esta es mi Sulucion鈥 Saludos

export function getStudentAverage(students) {
  let result = {
    classAverage: 0,
    students: [],
  }
  result.classAverage = Number(((students.map(x => (x.grades.reduce((a, b) => a + b, 0)) / x.grades.length).reduce((a, b) => a + b,)) / students.length).toFixed(2));

  for (let index = 0; index < students.length; index++) {

    result.students.push({ name: students[index].name, average: Number((students[index].grades.reduce((a, b) => a + b, 0) / students[index].grades.length).toFixed(2)) });
  }
  return result;
}

Despu茅s del desaf铆o anterior, pude resolver este con un poco menos de dificultad:

export function getStudentAverage(students) {
// declaramos el objeto a retornar
  const averageData = {
    classAverage: 0,
    students: [],
  }
// declaramos una variable para guardar el promedio total de la clase
  let totalAverage = 0;
// iteramos dentro del array 'students' para sacar el dato de las notas por estudiante
  for (let i = 0; i < students.length; i++) {
// declaramos una variable para guardar la suma de las notas por cada estudiante
    let suma = 0;
// iteramos dentro del array ''grades' para sumar cada nota
    for (let j = 0; j < students[i].grades.length; j++) {
// en cada iteraci贸n, se suma cada elemento dentro de 'grades' y se guarda en 'suma'
      suma += students[i].grades[j];
    }
// calculamos el promedio de notas de cada estudiante y lo guardamos en 'averageStudent'
    let averageStudent = Math.round((suma / students[i].grades.length) * 100) / 100;
// en cada iteraci贸n del primer ciclo, acumulamos el valor de 'averageStudent' para calcular el promedio de la clase
    totalAverage += averageStudent
// agregamos el nombre y promedio de cada estudiante a nuestro objeto 'averageData'
    averageData.students.push(
      {
        name: students[i].name,
        average: averageStudent,
      }
    );
  }
// calculamos el promedio total de la clase y lo guardamos dentro del objeto 'averageData'
  averageData.classAverage = Math.round((totalAverage / averageData.students.length) * 100) / 100
// retornamos nuestro objeto con la informaci贸n solicitada
  return averageData;
} 

Para resolver este desaf铆o, necesitamos calcular el promedio de cada estudiante y el promedio general de la clase. Primero, podemos recorrer el array de estudiantes con un bucle for para calcular el promedio de cada uno. Para ello, podemos utilizar el m茅todo reduce para sumar todas las notas de cada estudiante y despu茅s dividir el resultado entre la cantidad de notas que tiene cada estudiante.

Una vez que tenemos el promedio de cada estudiante, podemos sumar todos los promedios y dividirlos por la cantidad de estudiantes para obtener el promedio general de la clase.

Finalmente, creamos un objeto con las propiedades classAverage y students, donde classAverage tendr谩 el valor del promedio general de la clase y students ser谩 un array con los nombres de los estudiantes y sus respectivos promedios.

Aqu铆 est谩 el c贸digo para resolver el desaf铆o:

export function getStudentAverage(students) {
  let classTotal = 0;
  let studentsData = [];

  for (let i = 0; i < students.length; i++) {
    const student = students[i];
    const average = student.grades.reduce((acc, curr) => acc + curr) / student.grades.length;
    studentsData.push({ name: student.name, average: Number(average.toFixed(2)) });
    classTotal += average;
  }

  const classAverage = Number((classTotal / students.length).toFixed(2));

  return { classAverage, students: studentsData };
}

Soluci贸n humilde como el bicho:

S
I
U
U
U
U
U
U
U
U
U
U

export function getStudentAverage(students) {
  let classAverage
  let sumAverage = 0
  let studentsAverage = students.map(student => {
      let average = student.grades.reduce((currentNote, nextNote) =>(currentNote + nextNote), 0) / student.grades.length
      average = +average.toFixed(2)
      sumAverage += average
      return {
          name: student.name,
          average
      }
  })
  classAverage = +(sumAverage / students.length).toFixed(2) 
  return {
      classAverage,
      students: studentsAverage
  }
}

Soluci贸n

export function getStudentAverage(students) {
  // Tu c贸digo aqu铆 馃憟
  let averages = {
    classAverage: 0,
    students: []
  }
  let totalAverageStudents = 0;
  students.forEach(function (student) {
    let totalStudent = student.grades.reduce((a, b) => a + b);
    let averageStudent = Number((totalStudent / student.grades.length).toFixed(2));
    averages.students.push({
      name: student.name,
      average: averageStudent
    });

    totalAverageStudents += averageStudent;
  })

  averages.classAverage = Number((totalAverageStudents / students.length).toFixed(2));

  return averages;
}

@[email protected]
.
.
.
.
.
.
.
.
.
.

export function getStudentAverage(students) {
  const studentsAverage = students.map((student) => {
    return {
      name: student.name,
      average: Number(
        (
          student.grades.reduce((a, b) => a + b) / student.grades.length
        ).toFixed(2)
      ),
    };
  });
  const classAverage =
    studentsAverage
      .map((student) => {
        return student.average;
      })
      .reduce((a, b) => a + b) / studentsAverage.length;

  return {
    classAverage: Number(classAverage.toFixed(2)),
    students: studentsAverage,
  };
}

隆Hola, Platzinauta!
Objetivo
En este desaf铆o, deber谩s calcular el promedio general de una clase, as铆 como el promedio individual de cada estudiante.
Mi soluci贸n,
Se detalla hasta abajo.猬

export function getStudentAverage(students) {
  //@autor:dmos
  const myClass =
  {
    classAverage: 0,
    students: []
  };
  function myStudent(myName, myAverage) {

    this.name = myName;
    this.average = myAverage;

  };
  function calProm (numbers) {
    const reducedValue = numbers.reduce((suma, number) => suma + number);
    let myCalAverage = reducedValue / numbers.length;

    return (myCalAverage.toFixed(2) * 1);
  }
  students.forEach(element => {

    myClass.students.push(new myStudent(element.name, calProm(element.grades)));

  });

  myClass.classAverage = calProm(myClass.students.map(order => order.average));
  return (myClass);
}

鉁 Reto cumplido

馃毀
馃毀
馃毀
馃毀
馃毀
馃毀
馃毀
馃毀
馃毀
馃毀
馃毀
馃毀
馃毀
馃毀
馃毀
馃毀

function getStudentsAverage(students){
    // Creo el array de objetos que contiene el nombre y promedio de cada alumno
    const studentsAverage = students.map(student => {
        let sum = 0
        student.grades.forEach(grade => sum += grade)
        return {name: student.name, average: parseFloat((sum / student.grades.length).toFixed(2))}
    })

    // Calculo el promedio del aula 
    let sumAverage = 0
    studentsAverage.forEach(student => {sumAverage += student.average}) 
    const classAverage = parseFloat((sumAverage / studentsAverage.length).toFixed(2))
    
    // Retorno el promedio de la clase y el array de estudiantes y sus promedios respectivos
    return {classAverage, students: studentsAverage}
}

Por aqui mi solucion 馃
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

export function getStudentAverage(students) {
  // Tu c贸digo aqu铆 馃憟
  let averages = {
    classAverage: 0,
    students: []
  };

  students.forEach(student => {
    let calAverage = student.grades.reduce((accumulator, currentValue) => accumulator + currentValue);
    calAverage = calAverage / student.grades.length
    averages.classAverage += calAverage / students.length

    calAverage = Number(calAverage.toFixed(2))

    averages.students.push({
      name: student.name,
      average: calAverage
    })
  });

  averages.classAverage = Number(averages.classAverage.toFixed(2))

  return averages;
}```

Hola! Comparto mi soluci贸n:
.








export function getStudentAverage(students) {
  const totalAverage = [];
  const studentsArray = [];

  students.forEach((student) => {
    const average = Number((student.grades.reduce((accum, value) => accum + value, 0) / student.grades.length).toFixed(2));
    totalAverage.push(average);
    studentsArray.push({ name: student.name, average });
  });
  const totalClassAverage = Number((totalAverage.reduce((accum, value) => accum + value, 0) / totalAverage.length).toFixed(2));

  const classAverage = {
    classAverage: totalClassAverage,
    students: studentsArray
  };

  return classAverage;
}

buenas noches a todxs, aqui dejo mi solucion, pero tengo una duda, sucede que no pasa todas las pruebas pero lo probe en mi editor de codigo y obtengo las mismas respuestas que en la solucion, alguien me puede ayudar? gracias

<export function getStudentAverage(students) {
  
    const clase = {
      classAverage: 0,
    estudents: []
  };
let totalAverage =0
let longitud =0
    students.forEach(element => {
        totalAverage += element.grades.reduce((acum,curr)=>acum+curr,0)
        let partAverage = (element.grades.reduce((acum,curr)=>acum+curr,0))/(element.grades.length)
        longitud += element.grades.length
         
        clase.estudents.push({nombre:element.name,average:Number(partAverage.toFixed(2))}) 
    });
    //queda pendiente pulir esta parte!!!!!!!
    
    let promedio = totalAverage/(longitud)
    clase.classAverage = Number(promedio.toFixed(2))
  return clase  
  }
  > 

Aqu铆 envi贸 mi soluci贸n:

export function getStudentAverage(students) {
  // Tu c贸digo aqu铆 馃憟

    let classTotal = 0;
    let studentAverages = students.map(student => {
      let average = student.grades.reduce((sum, grade) => sum + grade, 0) / student.grades.length;
      classTotal += average;
      return {
        name: student.name,
        average: parseFloat(average.toFixed(2))
      };
    });
    let classAverage = parseFloat((classTotal / students.length).toFixed(2));
    return {
      classAverage: classAverage,
      students: studentAverages
    };
  }

Mi soluci贸n con la tres formas que se me ocurrieron para obtener los promedios como n煤meros con 2 decimales:

export function getStudentAverage(students) {
  // Tu c贸digo aqu铆 馃憟
  let classAverage = 0;
  let studentsAvg = [];
  students.forEach(student => {
    let average = student.grades.reduce((total, actualValue) => total += actualValue);
    //average = Math.round(average/student.grades.length*100)/100;
    //average = (average/student.grades.length).toFixed(2) - 0;
    average = Number((average/student.grades.length).toFixed(2));

    studentsAvg.push({
      name: student.name,
      average,
    });

    classAverage += average;
  });

  //classAverage = Math.round(classAverage/students.length*100)/100;
  //classAverage = (classAverage/students.length).toFixed(2) - 0;
  classAverage = Number((classAverage/students.length).toFixed(2));

  return {
    classAverage,
    students: studentsAvg,
  };
}

jajajaja reutilice el codigo pasado 馃槃

**
*
**
*
**
*
**
*
**
*
*
*
Solucion:

export function getStudentAverage(students) {
  let obj = {
    classAverage: 0,
    students: [],
  };
  let sumt = 0;
  let promt = 0;
  for (const student of students) {
    let sum = 0;
    let prom = 0;
    student.grades.forEach((grade) => {
      sum += grade;
    });
    prom = sum / student.grades.length;
    prom = parseFloat(prom.toFixed(2));
    obj.students.push({
      name: student.name,
      average: prom,
    });
    sumt += prom;
  }
  promt = sumt / students.length;
  promt = parseFloat(promt.toFixed(2));
  obj.classAverage = promt;
  return obj;
}

Tengo incovenientes con el playground se pone lento, y a veces tengo que modificar el codigo cuando se esta ejecutando la prueba para que funcione es un poco molesto, no se porque sucedera

Mi Solucion鈥 aunque no paso, obtengo el mismo resultado

function getStudentAverage(students) {
  // Tu c贸digo aqu铆 馃憟
  let classAverage= 0;
  const averageByStudents= students.map( ({name, grades}) => {
    let average = Number(
	(grades.reduce((acc, val)=> acc+= val,0) / grades.length).toFixed(2)
)
    classAverage += average;
    return {
      average,
      name,
    }
  });

  classAverage = Number((classAverage / students.length).toFixed(2))

  return {
    classAverage,
    averageByStudents
  }
}

Hola gente, comparto mi soluci贸n:

function getStudentAverage(students) {
   // crear estructura del objeto 
    let classAverage = {
        classAverage: 0,
        students: [{
            name: '',
            average: 0
        }]
    };

    // reiniciar array de students
    classAverage.students = [] 
    let generalAVG = 0;
    
    for (let i = 0; i < students.length; i++) {
        // obtener la suma de todas las notas por estudiante
        const student = students[i];
        const sumGrades = student.grades.reduce(function (sum, grades){
            return sum + grades;
        }, 0);

        // calcular promedio por cada estudiante
        let avg = sumGrades / student.grades.length;

        // guardar datos en el objeto     
        classAverage.students.push({name: student.name, average: Number(avg.toFixed(2))}) 
    }

    // sumar promedios de estudiantes
    for (let cas of classAverage.students) {
      generalAVG += cas.average;
  }
    
    // calcular el promedio general
    generalAVG = generalAVG / students.length
    classAverage.classAverage = Number(generalAVG.toFixed(2));

    return classAverage;
}


/* ********** EJECUCI脫N ********** */
let r = getStudentAverage([
    {
      name: "Pedro",
      grades: [90, 87, 88, 90],
    },
    {
      name: "Jose",
      grades: [99, 71, 88, 96],
    },
    {
      name: "Maria",
      grades: [92, 81, 80, 96],
    },
  ]);
console.log(r)

Mi soluci贸n:

export function getStudentAverage(students) {
  const averageStudents = []; 
  students.forEach(element => {
    const sumGradesStuden = element.grades.reduce(
      (acum, currentVal) => acum + currentVal,
      0);
    let average = Number((sumGradesStuden / element.grades.length).toFixed(2));
    let averageAndName = {
      'name': element.name,
      'average': average
    }
    averageStudents.push(averageAndName);

  })
  let sumGrades = 0; 

  averageStudents.forEach(element => {
    sumGrades += element.average;
  })
  const classAverage = Number((sumGrades / averageStudents.length).toFixed(2));
  return { 'classAverage': classAverage, 'students': averageStudents }
}

Les dejo aqui mi solucion, la verdad si me costo trabajo鈥 tal vez fue mucho texto pero me funciono
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

export function getStudentAverage(arreglo) {
  // Tu c贸digo aqu铆 馃憟
  let classAverage = 0;
  const objet = (average, students) => ({ classAverage, students });
  for (let i = 0; i < arreglo.length; i++) {
    let prom = parseFloat(((arreglo[i].grades.reduce((a, b) => a + b)) / arreglo[i].grades.length).toFixed(2));
    arreglo[i].average = prom;
    delete arreglo[i].grades;
    classAverage += prom;

  }
  classAverage = parseFloat((classAverage / arreglo.length).toFixed(2));
  return objet(classAverage, arreglo);
} 
<code> 

Costo un poco, pero pude llegar al resultado, aqu铆 mi respuesta:

function getStudentAverage(students) {
  // Tu c贸digo aqu铆 馃憟
  let result = {
    classAverage: 0,
    students: []
  };

  let promedioGeneral = 0;

  for (let i = 0; i < students.length; i++) {

    let sumatoria = 0;



    students[i].grades.forEach(element => {

      sumatoria += element

    });

    let promedio = Number((sumatoria / students[i].grades.length).toFixed(2));

    promedioGeneral += promedio

    let estudiante = { name: `${students[i].name}`, average: promedio }


    result.students.push(estudiante)
  }

  result.classAverage = Number((promedioGeneral / result.students.length).toFixed(2))

  return result;

};

馃洝锔廍scudo anti spoilers馃洝锔
馃洝锔廍scudo anti spoilers馃洝锔
馃洝锔廍scudo anti spoilers馃洝锔
馃洝锔廍scudo anti spoilers馃洝锔
馃洝锔廍scudo anti spoilers馃洝锔
馃洝锔廍scudo anti spoilers馃洝锔
馃洝锔廍scudo anti spoilers馃洝锔

Aqui va un humilde aporte 馃槃

export function getStudentAverage(students) {
  // create a new array object with totals of students with average grade per student
  const studentsWithAverage = students.map((student) => {
    const { name, grades } = student;
    const average = (
      grades.reduce((acum, grade) => acum + grade, 0) / grades.length
    ).toFixed(2);
    return {
      name,
      average: Number(average),
    };
  });

  // from new array with averages we can calculate total classAverage similar way at first time
  const classAverage = (
    studentsWithAverage.reduce((acum, student) => acum + student.average, 0) /
    students.length
  ).toFixed(2);

  return {
    classAverage: Number(classAverage),
    students: studentsWithAverage,
  };
}

Comparto mi soluci贸n para quienes est茅n trabados

export function getStudentAverage(students) {
  //Funci贸n para sumar notas. Tanto de los estudiantes como de la clase
  const sumaNotas = (notas) => notas.reduce(function (acumulador, suma) {
    return acumulador + suma
  }, 0)

  //Funci贸n para obtener el promedio de un estudiante. Acumula las notas del estudiante y las divide por la cantidad de materias (Se supone que la cantidad de materias siempre es mayor a 0)
  const obtenerPromedio = (estudiante) => {
    const cantMaterias = estudiante.grades.length
    const notas = sumaNotas(estudiante.grades)
    return notas / cantMaterias
  }

  //Obtiene el promedio de la clase. Acumula el promedio de cada estudiante en soloNotas y luego suma todo para dividirlo por la cantidad de estudiantes y encontrar el promedio de la clase
  const obtenerPromedioClase = (estudiantes) => {
    const soloNotas = estudiantes.map(function (estudiante) {
      return obtenerPromedio(estudiante)
    })
    const cantEstudiantes = soloNotas.length
    const notas = sumaNotas(soloNotas)
    return notas / cantEstudiantes
  }

  //Genero el objeto que contiene el nombre y promedio de cada estudiante
  let estudiantesPromedios = []

  students.map(function (estudiante) {
    let estudianteNuevo = {
      'name':estudiante['name'],
      'average': parseFloat(obtenerPromedio(estudiante).toFixed(2))
    }
    estudiantesPromedios.push(estudianteNuevo)
  })

  //Para calcular el promedio de la clase utilizo students como par谩metro en vez de estudiantesPromedios porque el promedio en estudiantesPromedios lo redonde茅 en 2 decimales y puede haber una peque帽a diferencia
  const clasePromedio = parseFloat(obtenerPromedioClase(students).toFixed(2))

  //Retorno un objeto con el promedio de la clase y el promedio individual de cada estudiante

  return { 'classAverage': clasePromedio, 'students': estudiantesPromedios }
}

Mi solucion, hice uso de dos clases:

function getStudentAverage(students) {
  class AverageEstudent {
    constructor(name, average) {
      this.name = name;
      this.average = average;
    }
  }
  class TotalAverage {
    constructor(students) {
      this.students = students;
      this.classAverage = 
	this.calculateTotalAverage(students);
    }

    calculateTotalAverage(students) {
      const mappingStudents = students.map(student => { 
	return student.average });
      const totalAverage = Number(
	(mappingStudents.reduce((a, b) => { return a + b })
	 / mappingStudents.length).toFixed(2));
      return totalAverage
    }
  }

  let arrStudents = [];

  students.forEach((student) => {
    const average = Number((student.grades.reduce(
	(a, b) => {return a + b}) 
	/ student.grades.length).toFixed(2));
    arrStudents.push(
	new AverageEstudent(student.name, average)
	);
  })
  
  let totalAverage = new TotalAverage(arrStudents);
  console.log(totalAverage);
  return totalAverage;
}

the code

function getStudentAverage(students) {
  const newStudents = [];
  let classAverage = 0;
  for(let i = 0; i<students.length; i++) {
    const sum = students[i].grades.reduce((partialsum, a) => partialsum + a, 0);
    newStudents.push({
      name: students[i].name,
      average: parseFloat((sum/students[i].grades.length).toFixed(2))
    })
    classAverage += parseFloat((sum/students[i].grades.length).toFixed(2));   
  }
  return {
    classAverage: parseFloat((classAverage/students.length).toFixed(2)),
    students: newStudents
  }
}

Mi aporte

export function getStudentAverage(students) {
  let classAverage;
  let studentAvg = [];
    let result = {
      classAverage: 0,
      students: []
  };

  students.forEach((item) => {
    let gradesAverage = item.grades.reduce((a,b) => a + b)/item.grades.length;
    studentAvg.push(gradesAverage);
    let student = {
    	name: item.name,
      average: parseFloat(gradesAverage.toFixed(2))
    };
    result.students.push(student);
  });
  classAverage = studentAvg.reduce((a,b) => a + b)/studentAvg.length;
  result.classAverage = parseFloat(classAverage.toFixed(2));
	console.log(result);
}

La verdad que no entiendo c贸mo funciona ese playground, prob茅 en la consola del browser y tuve el resultado esperado con el input de prueba que proporcionaron ustedes, pero cuando corro los tests en la plataforma de Platzi no funcionan, no entiendo qu茅 est谩 mal 馃槓

.
. SPOILERS
.

.
.
.
.
.
.

.
.
.
.

.
.
.
.
.
.

.
.

export function getStudentAverage(students) {

  const studentsPro = students.map(({ name, grades }) => {
    const numGrades = grades.reduce((acc, curr) => acc + curr, 0)
    const average = +(numGrades / grades.length).toFixed(2)
    return { name, average }
  })

  const classAverage = +((studentsPro.reduce((acc, curr) => acc + curr.average, 0)) / studentsPro.length).toFixed(2)

  return { classAverage, "students": studentsPro }
}

Me tom贸 mucho tiempo pero lo logr茅.
Cuidado con spoilers
|
|
|
|
|
|
|
|
|
|
|
|
|

function getStudentAverage(students) {


  const estudiantes = []
  const arrayPromedioFinal = []

  for (let i = 0; i < students.length; i++) {
    const student = students[i]
    student.average = student.grades.reduce((a, b) => a + b, 0) / student.grades.length
    const estudiante = {
      name: student.name,
      average: Number(student.average.toFixed(2))
    }
    arrayPromedioFinal.push(estudiante.average)
    estudiantes.push(estudiante)
  }

  const promedioClase = Number((arrayPromedioFinal.reduce((a, b) => a + b) / arrayPromedioFinal.length).toFixed(2))

  const respuesta = {
    classAverage: promedioClase,
    students: estudiantes
  }

  return respuesta
}

Comparto mi respuesta:

export function getStudentAverage(students) {
  // Obtenemos el promedio individual y retornamos un nuevo objeto proms{name:String,average:Number}.
  const proms = students.map(({ name, grades }) => {
    return {
      name,
      average: Number((grades.reduce((sum, val) => sum + val) / grades.length).toFixed(2))
    }
  });
  // Obtenemos el promedio de la clase.
  const classAverage = Number((proms.map(est => est.average).reduce((sum, val) => sum + val) / proms.length).toFixed(2));
  // Retornamos el nuevo objeto con los valores anteriores.
  return {
    classAverage,
    students: proms,
  }
}

馃槃 馃槃

undefined