Today I Learned

hashrocket A Hashrocket project

Filter empty strings from array

Given an array with many empty strings

arr = ["a", "", "b", "", "c", "", "d"];

To get rid of the empty strings call filter and pass the Boolean method.

> ["a", "b", "c", "d"]

See More #javascript TILs
Looking for help? At Hashrocket, our JavaScript experts launch scalable, performant apps on the Web, Android and iOS. Contact us and find out how we can help you.