Returns a new array without the empty strings.
var myArray = [ "hakan", "", "0", 0, false ];
myArray = myArray.filterEmpty();
// it became this:
[ "hakan", "0", 0, false ]
Array.prototype.filterEmpty = function() { | |
this.filter(function(item) { | |
return item.length; | |
}); | |
}; |