This question was asked here: Remove empty strings from array while keeping record of indexes with non empty strings
If you\'d notice the given as @Baz layed it out;
If are using jQuery, grep may be useful:
var arr = [ a, b, c, , e, f, , g, h ]; arr = jQuery.grep(arr, function(n){ return (n); });
arr is now [ a, b, c, d, e, f, g];
arr
[ a, b, c, d, e, f, g];