Good day.
I want to know how to remove all false elements from an array in js, the problem is that something goes wrong on the false element. Quite already confused. ( Tell me please.
function bouncer(arr) { for(var i = 0; i < arr.length; i++) { if (!(arr[i])) { arr.splice(i, 1); } } return arr; } console.log(bouncer([7, 'ate', '', false, 9]));