Tell us what’s happening:
why isn’t working the code
Your code so far
function bouncer(arr) {
// Don't show a false ID to this bouncer.
for(i=0; i<arr.length; i++){
if(arr[i]==false){
arr.splice(i,1);
}
}
return arr;
}
bouncer([7, "ate", "", false, 9]);
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/67.0.3396.99 Safari/537.36.
You are just checking if the element is the false.
Remember every element has a Boolean value. Check that instead.
So if (true) {…}
Then you won’t even have to slice, you can push the values to a new array.