7 ms·
One of the advantages of underscore (and lodash) is that you can iterate over arrays AND objects indistinctly in most cases. How would you do: var a1b2 = _.r
by maroshii 11y ago
One of the advantages of underscore (and lodash) is that you can iterate over arrays AND objects indistinctly in most cases. How would you do:
var a1b2 = _.reduceRight({a:1,b:2},(memo,val,key) => key+val+memo,'');
or:
var two = _.find({a:2,b:3,c:4},(val,key) => key !== 'a' && key !== 'c' )
Until I see _.chain, _.compose, _.partialRight, _.zip or _.throttle (among others) implemented in the standard library lodash is a no-opt.
With iterables and the "for of" loop javascript is definitely not going in the direction of functional programming though.