Skip to content

Commit

Permalink
tallninja - Ernest
Browse files Browse the repository at this point in the history
  • Loading branch information
tallninja committed Feb 23, 2024
1 parent fa75741 commit 538f409
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions tallninja/count_zeros.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
function countZeros(numbers) {
let count = 0;

for (let number of numbers) {
if (number === 0) {
count += 1;
}
}

return count;
}


// const numbers = [1, 0, 5, 6, 0, 2];
// const zeroCount = countZeros(numbers); // 2
// console.log(`[1, 0, 5, 6, 0, 2] = ${zeroCount}`);

0 comments on commit 538f409

Please sign in to comment.