-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpromPonde.js
More file actions
40 lines (35 loc) · 865 Bytes
/
Copy pathpromPonde.js
File metadata and controls
40 lines (35 loc) · 865 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
const notes = [
{
course: "Educación Física",
note: 10,
credit: 2,
},
{
course: "Programación",
note: 8,
credit: 5,
},
{
course: "Finanzas personales",
note: 7,
credit: 5,
},
];
const notesWithCredit = notes.map(function (noteObject) {
return noteObject.note * noteObject.credit;
});
console.log(notesWithCredit);
const sumOfNotesWithCredit = notesWithCredit.reduce(function (sum = 0, newVal) {
return sum + newVal;
});
console.log(sumOfNotesWithCredit);
const credits = notes.map(function (noteObject) {
return noteObject.credit;
});
console.log(credits);
const sumOfCredits = credits.reduce(function (sum = 0, newVal) {
return sum + newVal;
});
console.log(sumOfCredits);
const promedioPonderadoNotasConCreditos = sumOfNotesWithCredit / sumOfCredits;
console.log(promedioPonderadoNotasConCreditos);