For the following exercise you can use ES5 or ES6 syntax, whichever you feel more comfortable with at this point.
Go ahead to Repl.it , using the code below as your starting point.
Introduction:
Imagine you are a Math teacher and you have to grade your students based on their performance on three projects. We got the info for each student in an object that looks like this:
{
name: "Student Name",
firstProject: 80,
secondProject: 75,
finalProject: 90
}
Task:
The whole class is represented as an array of objects (each object contains the data about that student).
Using the method map()
we need to create a new array of objects. The objects will contain only student´s name
, and their final grade, which will be the new property named finalGrade
.
finalGrade
should be the average of the score that the student had on 3 projects.
The formula for the finalGrade
should look like this :
(firstProject + secondProject + finalProject) / 3
Expected Result:
/*
0: {name: "Tony Parker", finalGrade: 82}
1: {name: "Marc Barchini", finalGrade: 71}
2: {name: "Claudia Lopez", finalGrade: 80}
3: {name: "Alvaro Briattore", finalGrade: 81}
4: {name: "Isabel Ortega", finalGrade: 69}
5: {name: "Francisco Martinez", finalGrade: 74}
6: {name: "Jorge Carrillo", finalGrade: 83}
7: {name: "Miguel López", finalGrade: 77}
8: {name: "Carolina Perez", finalGrade: 75}
9: {name: "Ruben Pardo", finalGrade: 75}
*/
Go ahead to Repl.it, using the code below as your starting point.