Created
September 18, 2019 15:51
-
-
Save sscotth/41a35ff3116f5c7cbd804459c33123d0 to your computer and use it in GitHub Desktop.
JS Object.map
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const obj = { foo: 'hello', bar: 'world' } | |
const updatedObj = Object.fromEntries( | |
Object.entries(obj).map(([key, val]) => [ | |
key, | |
val.toUpperCase(), | |
]), | |
) | |
// {foo: "HELLO", bar: "WORLD"} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
for the adventurous: