Filter out an array with null values, underscore

Try using _.without(array, *values) it will remove all the values that you don't need. In your case *values == null

http://underscorejs.org/#without


If the array contains either nulls or objects then you could use compact:

var everythingButTheNulls = _.compact(list);

NB compact removes all falsy values so if the array could contain zeros, false etc then they would also be removed.

Could also use reject with the isNull predicate:

var everythingButTheNulls = _.reject(array, _.isNull);