what’s going wrong? what are the failing tests? what do you think is the issue? help us to help you - next time we may not know what to tell you without these infos
NaN is a data type, not a string, an NaN === NaN is always false
instead you should be using the characteristic of falsy characters, that when evaluated as a Boolean, they evaluate as false
for example, if you do Boolean(null) it will evaluate as false. you don’t need to use Boolean() because the condition of an if statement is evaluated as a boolean already
function bouncer(arr) {
// Don't show a false ID to this bouncer.
let arr1 = [];
for ( let i = 0; i < arr.length ; i++){
if (arr[i] ) {
arr1.push(arr[i]);
}
}console.log(arr1);
return arr1;
}
bouncer([1, null, NaN, 2, undefined]);