Skip to content

Commit

Permalink
Fix typo referencing Map instead of Object (#37050)
Browse files Browse the repository at this point in the history
This text should pretty clearly be referencing `Object.groupBy` in this location, instead of the related `Map.groupBy` function.
  • Loading branch information
Mr0grog authored Dec 2, 2024
1 parent e6f5295 commit 02c34c1
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ A [`null`-prototype object](/en-US/docs/Web/JavaScript/Reference/Global_Objects/

## Description

`Object.groupBy()` calls a provided `callbackFn` function once for each element in an iterable. The callback function should return a string or symbol (values that are neither type are [coerced to strings](/en-US/docs/Web/JavaScript/Reference/Global_Objects/String#string_coercion)) indicating the group of the associated element. The values returned by `callbackFn` are used as keys for the object returned by `Map.groupBy()`. Each key has an associated array containing all the elements for which the callback returned the same value.
`Object.groupBy()` calls a provided `callbackFn` function once for each element in an iterable. The callback function should return a string or symbol (values that are neither type are [coerced to strings](/en-US/docs/Web/JavaScript/Reference/Global_Objects/String#string_coercion)) indicating the group of the associated element. The values returned by `callbackFn` are used as keys for the object returned by `Object.groupBy()`. Each key has an associated array containing all the elements for which the callback returned the same value.

The elements in the returned object and the original iterable are the same (not {{Glossary("deep copy", "deep copies")}}). Changing the internal structure of the elements will be reflected in both the original iterable and the returned object.

Expand Down

0 comments on commit 02c34c1

Please sign in to comment.