To remove empty strings from array while keeping record without loops with JavaScript, we call the filter method.
For instance, we write
const arr = ["I", "am", "", "still", "here", "", "man"];
const newArr = arr.filter(Boolean);
to call arr.filter with Boolean to return a new array without the falsy values in arr.
Empty string is a falsy value so it’s filtered out.