code is right in this way but
Your code so far
function bouncer(arr) {
// Don't show a false ID to this bouncer.
let narr=[];
for(let i in arr)
{
if(arr[i])
{
narr.push(arr[i]);
}
}
return narr;
}
console.clear();
console.log(bouncer([7, "ate", "", false, 9]));
when i write it like this there is some problem
function bouncer(arr) {
// Don't show a false ID to this bouncer.
for(let i in arr)
{
if(!arr[i])
{
arr.splice(i,1);
}
}
return arr;
}
console.clear();
console.log(bouncer([7, "ate", "", false, 9]));
Link to the challenge:
https://learn.freecodecamp.org/javascript-algorithms-and-data-structures/basic-algorithm-scripting/falsy-bouncer