3 ms·
> That could have been the entire article As for me, except for this: Instead of reading every() as “does every item in this array match this condition?” read
by DemocracyFTW2 3y ago
> That could have been the entire article
As for me, except for this:
Instead of reading every() as “does every item in this array match this condition?” read it as, “is there any item in this array that doesn’t match this condition?” That shift in thinking can help avoid errors in your JavaScript code going forward.
When I last had to implement an `all_of( collection, test )` functionality, I was stumped as for the edge case of an empty collection, until I realized that I wanted `all_of( c, t )` to behave exactly like `none_of( c, nt )` with `nt = ( x ) -> not t( x )`