<p>How do I remove empty elements from an array in JavaScript? </p>

<p>Is there a straightforward way, or do I need to loop through it and remove them manually?</p>

Try this.  Pass it your array and it will return with empty elements removed.  *Updated to address the bug pointed out by Jason
```
```
function removeEmptyElem(ary) {
    for (var i = ary.length - 1; i >= 0; i--) {
        if (ary[i] == undefined)  {
            ary.splice(i, 1);
        }       
    }
    return ary;
}
```
```