Update snippet descriptions
This commit is contained in:
@ -3,7 +3,7 @@ title: mapObject
|
||||
tags: array,object,intermediate
|
||||
---
|
||||
|
||||
Maps the values of an array to an object using a function, where the key-value pairs consist of the original value as the key and the result of the function as the value.
|
||||
Maps the values of an array to an object using a function.
|
||||
|
||||
- Use `Array.prototype.reduce()` to apply `fn` to each element in `arr` and combine the results into an object.
|
||||
- Use `el` as the key for each property and the result of `fn` as the value.
|
||||
|
||||
Reference in New Issue
Block a user