@@ -1323,6 +1323,10 @@ Group items by key.
13231323 var grouped = [' one' , ' two' , ' three' ].reduce ((r , v , i , a , k = v .length ) => ((r[k] || (r[k] = [])).push (v), r), {})
13241324 console .log (grouped)
13251325 // output: {3: ["one", "two"], 5: ["three"]}
1326+
1327+ // Native
1328+ Object .groupBy ([' one' , ' two' , ' three' ], ({length}) => length)
1329+ // output: {3: ["one", "two"], 5: ["three"]}
13261330 ```
13271331
13281332 ``` js
@@ -1335,6 +1339,10 @@ Group items by key.
13351339 var grouped = [1.3 , 2.1 , 2.4 ].reduce ((r, v, i, a, k = Math .floor (v)) => ((r[k] || (r[k] = [])).push (v), r), {})
13361340 console .log (grouped)
13371341 // output: {1: [1.3], 2: [2.1, 2.4]}
1342+
1343+ // Native
1344+ Object .groupBy ([1.3 , 2.1 , 2.4 ], num => Math .floor (num))
1345+ // output: {1: [1.3], 2: [2.1, 2.4]}
13381346 ```
13391347
13401348#### Browser Support for ` Array.prototype.reduce() `
@@ -1343,6 +1351,12 @@ Group items by key.
13431351:-: | :-: | :-: | :-: | :-: | :-: |
13441352 ✔ | ✔ | 3.0 ✔ | 9.0 ✔ | 10.5 ✔ | 4.0 ✔ |
13451353
1354+ #### Browser Support for ` Object.groupBy() `
1355+
1356+ ![ Chrome] [ chrome-image ] | ![ Edge] [ edge-image ] | ![ Firefox] [ firefox-image ] | ![ IE] [ ie-image ] | ![ Opera] [ opera-image ] | ![ Safari] [ safari-image ]
1357+ :-: | :-: | :-: | :-: | :-: | :-: |
1358+ 117.0 ✔ | 117.0 ✔ | 119.0 ✔ | ✖ | 103.0 ✔ | 16.4 ✔ |
1359+
13461360** [ ⬆ back to top] ( #quick-links ) **
13471361
13481362### _ .includes
0 commit comments