array-partition
utility function - partitions array
into two arrays, where the first one contains elements for which fn
returns a truthy value, and the second one – for which fn
returns something falsy (as seen on Enum.partition/2)
Composes nicely with ES6 destructuring assignment
partition(array, predicate(element, index, array))
; let even odd = ;// even == [1,3,5,7,9], odd == [2,4,6,8,10] const letters = 'a''b''c''d''e''f''g''h''i''j''k''l''m''n''o''p''q''r''s''t''u''w''x''y''z';let firstThreeLetters rest = ;// firstThreeLetters == ['a','b','c']