Update snippet descriptions

This commit is contained in:
Isabelle Viktoria Maciohsek
2020-10-21 21:54:53 +03:00
parent 47276ac092
commit ce48fffb4d
41 changed files with 171 additions and 110 deletions

View File

@ -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.