1//returns the number of true values there are in an array
2function countTrue(arr) {
3 return arr.filter(w => w === true).length;
4}
5
6console.log(countTrue([true, false, false, true, false]));// 2
7console.log(countTrue([false, false, false, false]));// 0
8console.log(countTrue([]));// 0