© 2026 LinearBytes Inc.
Search posts, tags, users, and pages
Philip Birk-Jensen
Great examples!
I like approach 2 the most, a tiny bit slower than #1 (not tested, just a hunch since the filter() function tends to be slower than forEach()), but easier to read and understand (a matter of taste).
filter()
forEach()
Jennifer Bland
Senior Software Engineer. Google Developers Expert. Entrepreneur. Mountain Climber. Cat Lover. Gardener. World traveler.
Philip,
#3 is my favoriate :-)