Update snippet descriptions
This commit is contained in:
@ -3,9 +3,9 @@ title: mapValues
|
||||
tags: object,intermediate
|
||||
---
|
||||
|
||||
Creates an object with the same keys as the provided object and values generated by running the provided function for each value.
|
||||
Maps the values of an object using the provided function, generating a new object with the same keys.
|
||||
|
||||
- Use `Object.keys(obj)` to iterate over the object's keys.
|
||||
- Use `Object.keys()` to iterate over the object's keys.
|
||||
- Use `Array.prototype.reduce()` to create a new object with the same keys and mapped values using `fn`.
|
||||
|
||||
```js
|
||||
|
||||
Reference in New Issue
Block a user