The exercise is to return the number of truthy values in an array. I can’t get it to work properly. I always get the wrong answer. This is Mosh’s solution and it still doesnt work:
const array = [‘0’, null, undefined, ‘’, ‘2’, ‘3’ ];
console.log(countTruthy(array));
function countTruthy(array){
let count = 0;
for (let value of array)
if (value)
count++;
return count;
}