MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/javascript/comments/bidtu1/7_useful_javascript_tricks/em1ej5d/?context=3
r/javascript • u/xxammuxx • Apr 28 '19
36 comments sorted by
View all comments
8
This is a pretty worthless comment, but if you were code golfing...
['', 123, 0, 'foo'].filter(Boolean) ['', 123, 0, 'foo'].filter(x=>!!x)
...the latter is one less character.
1 u/[deleted] Apr 29 '19 [removed] — view removed comment 10 u/SoInsightful Apr 29 '19 The V8 engine is very well-optimized, and will certainly cache the function for you.
1
[removed] — view removed comment
10 u/SoInsightful Apr 29 '19 The V8 engine is very well-optimized, and will certainly cache the function for you.
10
The V8 engine is very well-optimized, and will certainly cache the function for you.
8
u/DGCA Apr 29 '19
This is a pretty worthless comment, but if you were code golfing...
...the latter is one less character.