Closed odv closed 5 years ago
@odv I think the tests are broken. It says to check for bad values but doesn't specify what to return in that scenario.
function countSheeps(arrayOfSheep) {
let numberOfSheeps = arrayOfSheep.filter( (sheep) => sheep == true );
return numberOfSheeps.length > 0 ? `There are ${numberOfSheeps.length} sheeps in total` : `There are no sheeps at all`;
}
function countSheeps(arrayOfSheep) {
return arrayOfSheep.filter( (sheep) => sheep == true ).length;
}
https://www.codewars.com/kata/counting-sheep-dot-dot-dot/train/javascript