Skip to content

Latest commit

 

History

History
14 lines (12 loc) · 464 Bytes

count-anils.md

File metadata and controls

14 lines (12 loc) · 464 Bytes

Write a function which takes an array of 4 names, and returns a count of the number of times the name 'Anil' appears in the array.

Tip: Use four if statements

CODE TEMPLATE


function countAnils(names){
// write your code here
}
console.log(countAnils(['Paul', 'Anil', 'Kim', 'Anil'])); // Should print 2
console.log(countAnils(['Paul', 'Sam', 'Kim', 'Rajesh'])); // Should print 0