Write a function called countEvenWords which accepts an array of objects. Each of these objects will have a key of firstName with a value that is a string. Return the number of firstName values that have a length that is even.
Why is it returning everything to 0?
function countEvenWords(obj) {
let count = 0;
for (let key in obj) {
if (obj[key].length % 2 === 0) {
count++
}
}
return count;
}
console.log(countEvenWords([{firstName: "Mark"}, {firstName: "Sasha"}])); // 1
console.log(countEvenWords([{firstName: "Tanya"}, {firstName: "Sasha"}])); // 0