What's missing in this code?
// count all types of true's
countTrue(["True", "false", false, true, "TRUE", "randomString", 1, "false"]); // 3
countTrue([true, false, "true", "FALSE", "True", null, undefined, "False"]); // 3
const countTrue = arr => arr.filter(item => {
if (typeof item === 'boolean') {
return item;
}
if (
) {
const lowerItem = item.
;
if (
) return true;
if (
) return false;
}
return false;
}).length;
Type or select from these options