Drucken Sie ungerade Zahlen in einem Array in JavaScript aus
[1,2,3,4].forEach((num) => num % 2 === 0 && console.log(num));
GitPaulo
[1,2,3,4].forEach((num) => num % 2 === 0 && console.log(num));
public int[] findEvens() {
int numberEvens = 0;
for (int i = 0; i < numbers.length; i++) {
if (numbers[i] % 2 == 0) {
numberEvens++;
}
}
public int[] findEvens() {
int numberEvens = 0;
for (int i = 0; i < numbers.length; i++) {
if (i % 2 == 0) {
numberEvens++;
}
}