Future Javascript: groupBy() methode

Future Javascript: groupBy() methode

groupby() methode are an upcoming feature to Javascript which make grouping of items in an array easier. it have the same functionality of _.groupBy methode in lodash library .

currently this proposal is on stage 2 but there is a polyfill available in the core-js library .

this methode return an object composed of keys generated from the results of running each element of collection through the iteratee function. The order of the grouped values is determined by the order they occur in the collection. Also the corresponding value of each key is an array of elements responsible for generating the key.

so now let's dive in into code and know haw this mehode work :

code.png