So, I have an instance where I'm filtering some arrays and I've ended up with undefined in my array. I can't have this since it affects the function I pass this array to. I want the array to build only what has data. Refer to my example code and I'm sure you'll see what I mean:

```
var foo = ['one', 'two', 'one', 'three', 'one', 'one'];
var bar = [];

for (var i=0, l = foo.length; i < l; i++) {
    if(foo[i].includes('one') !== false){
        bar[i]=foo[i];
    }
}
console.log(bar);

```

Here is a fiddle: <https://jsfiddle.net/o3b1m2u0/>

I tried using another counter and offsetting it but I can't seem to get it right. Ideas?