Hello! Can someone why I got 1 instead of ["a"] (given noF(["a",false]) )in this function? How should I solve this?
I need to get an array that doesn’t contain any falsy values
function noF (arr) {
const newArr= arr.reduce((acc,el)=>{
if (el){
return acc.push(el);
}
return acc;
}, []);
return newArr;
}