Series: JavaScript Masalalari 11

Juft sonlar soni

Array ichida nechta juft son borligini topadigan funksiya yozing.

Masala

Array ichida nechta juft son borligini toping.

  • Funksiya nomi: countEven
  • Parametr: sonlardan iborat array numbers
  • Natija: juft sonlar soni (butun son)

Misollar

countEven([1, 2, 4, 5]); // 2
countEven([2, 6, 8]); // 3
countEven([1, 3, 5]); // 0

console.log(...) orqali tekshiring.

Practice & Try It Out

Note: Use console.log() to print output

Write your code here and click "Run" to see the output

Output