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;
You can use lodash's method, it works for string, number and boolean type
_.compact([0, 1, false, 2, '', 3]); // => [1, 2, 3]
https://lodash.com/docs/4.17.15#compact