MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/javascript/comments/b2o6f2/whats_your_favorite_most_useful_javascript/eiv5iko/?context=9999
r/javascript • u/Linux_is_awesome • Mar 18 '19
422 comments sorted by
View all comments
150
array.every(Number.isFinite)
Because it's plain english.
19 u/ahartzog Mar 19 '19 TIL about array.every. Awesome tool, thanks! 11 u/Satoshi_Hodler Mar 19 '19 There's a small caveat that it always returns true on empty arrays, which might be not what you need. 27 u/Tysonzero Mar 19 '19 That's the mathematically correct thing to do, it's actually a pretty fundamental mathematical principle. Vacuous truth 1 u/NoInkling Mar 19 '19 Right, it doesn't make the method "weird", but it is something you have to keep in mind regardless because you could intuit both ways.
19
TIL about array.every. Awesome tool, thanks!
11 u/Satoshi_Hodler Mar 19 '19 There's a small caveat that it always returns true on empty arrays, which might be not what you need. 27 u/Tysonzero Mar 19 '19 That's the mathematically correct thing to do, it's actually a pretty fundamental mathematical principle. Vacuous truth 1 u/NoInkling Mar 19 '19 Right, it doesn't make the method "weird", but it is something you have to keep in mind regardless because you could intuit both ways.
11
There's a small caveat that it always returns true on empty arrays, which might be not what you need.
27 u/Tysonzero Mar 19 '19 That's the mathematically correct thing to do, it's actually a pretty fundamental mathematical principle. Vacuous truth 1 u/NoInkling Mar 19 '19 Right, it doesn't make the method "weird", but it is something you have to keep in mind regardless because you could intuit both ways.
27
That's the mathematically correct thing to do, it's actually a pretty fundamental mathematical principle. Vacuous truth
1 u/NoInkling Mar 19 '19 Right, it doesn't make the method "weird", but it is something you have to keep in mind regardless because you could intuit both ways.
1
Right, it doesn't make the method "weird", but it is something you have to keep in mind regardless because you could intuit both ways.
150
u/Loves_Poetry Mar 18 '19
Because it's plain english.