Hola!
Les comparto mi solución de los ejercicios del desafío.
//1
let listaGenerica = [];
//2
let programmingLanguages = ['JavaScript', 'C', 'C++', 'Java', 'Kotlin'];
//3
programmingLanguages.push(['Java', 'Ruby', 'GoLang']);
//4
let showProgrammingLanguages = () =>
programmingLanguages.forEach((e) => console.log(e));
//5
let reverseShowProgrammingLanguages = () =>
programmingLanguages
.slice()
.reverse()
.forEach((e) => console.log(e));
//6
function average(grades) {
let total = grades.length;
let sum = grades.reduce((acc, current) => acc + current);
return sum / total;
}
//7
function maxAndMin(grades) {
let max = Math.max(grades);
let min = Math.min(grades);
console.log(
`El numero mas grande es: ${max} y el numero mas pequeño es: ${min}`
);
}
//8
let sumAll = (grades) => grades.reduce((acc, current) => acc + current);
//9
let findValue = (value, array) => array.indexOf(value);
//10
function sumOneByOne(array1, array2) {
if (array1.length === array2.length) {
let arr = [];
for (let i = 0; i < array1.length; i++) {
arr.push(array1[i] + array2[i]);
}
return arr;
}
return;
}
//11
let squaredArray = (arr) => arr.map((val) => Math.pow(val, 2));