Tell us what’s happening:
Describe your issue in detail here.
**Your code so far**
let a = false;
if (!!a === false) console.log(8);
> here the if condition returns true
function bouncer(arr) {
for(let i = 0; i < arr.length; i++){
if(!!arr[i] === false) {
But here it doesn't
arr.splice(i, 1);
}
}
return arr;
}
console.log(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/98.0.4758.102 Safari/537.36
Splicing changes the size of the array and changes the indexes of all later elements. Changing the array as you iterate over it is generally a bad idea.