Contact: aviboots(AT)netvision.net.il
40,875 questions
53,283 answers
573 users
const arr = [4, 1, 2, 8, 9, 5, 2, 2, 2, 5, 1, 7, 8, 2, 8]; let count = 0; arr.forEach(element => { if (element === 2) { count += 1; } }); console.log(count); /* run: 5 */