Aufgaben-Python/courses/javascript/02_funktionen_und_arrays/musterloesung.js

11 lines
235 B
JavaScript

function verdoppeln(zahlen) {
return zahlen.map(x => x * 2);
}
function filterGeradeZahlen(zahlen) {
return zahlen.filter(x => x % 2 === 0);
}
function arraySumme(zahlen) {
return zahlen.reduce((acc, curr) => acc + curr, 0);
}