Skip to content

Commit 2f3fbcf

Browse files
committed
Empezando taller 3, termianada logica de promedio
1 parent 34c03b3 commit 2f3fbcf

File tree

3 files changed

+46
-0
lines changed

3 files changed

+46
-0
lines changed

README.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,3 +15,10 @@
1515
- Segundo paso: implementar la fórmulas en JavaScript
1616
- Tercer paso: crear funciones
1717
- Cuarto paso: integrar JS con HTML
18+
19+
## Taller #3: promedio, mediana y moda
20+
21+
- Primer paso: definir las fórmulas
22+
- Segundo paso: implementar la fórmulas en JavaScript
23+
- Tercer paso: crear funciones
24+
- Cuarto paso: integrar JS con HTML

promedio.html

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8">
5+
<meta http-equiv="X-UA-Compatible" content="IE=edge">
6+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
7+
<title>Promedio</title>
8+
</head>
9+
<body>
10+
<header>
11+
<h1>Calculando el promedio</h1>
12+
</header>
13+
14+
<script src="./promedio.js"></script>
15+
</body>
16+
</html>

promedio.js

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
2+
//Función que calcula el promedio de una array (suma todos sus valores y luego los divide entre su numero de valores.)
3+
const calculateMiddleArithmetic = (list) => {
4+
const reducer = (accumulator, currentValue) => accumulator + currentValue;
5+
6+
const sumList = list.reduce(reducer);
7+
8+
const averageList1 = sumList / list.length;
9+
console.log(averageList1);
10+
}
11+
12+
13+
14+
15+
16+
17+
18+
// let sumList1 = 0;
19+
20+
// for (let i = 0; i < lista.length; i++) {
21+
// sumList1 += lista[i];
22+
// };
23+
// console.log(sumList1);

0 commit comments

Comments
 (0)