Create a function trueCount which returns the number of true values in the array.
Examples
trueCount([false, true, false, true, false]) ➞ 2
trueCount([true, true, true, true]) ➞ 4
trueCount([]) ➞ 0
Solution:
const count_true = r => r.filter(Boolean).length
or
function trueCount(arr) {
const trueCount = arr.reduce((total, item)=>total+Number(item), 0)
return trueCount;
}