const arr = [5, 'one', 0, 1, false, 2, NaN, '', 3, undefined]; const new_arr = _.compact(arr)
The _.compact() method takes the array as parameter and return new array that does not contains falsey values.
Live Demo
0 Comments