© 2026 LinearBytes Inc.
Search posts, tags, users, and pages
Anthony Fung
Angular/.NET Web developer. I write insights, thoughts, and stories to help software developers build a solid foundation for their skills
Good solution!
You can do the same by relying on the truthiness of a value too, e.g. myArray.filter(n => n);. Something to be careful of is that 0 is considered a falsy value.
myArray.filter(n => n);
0