Created
March 18, 2017 18:17
-
-
Save Woodsphreaker/5eb6b99cd9182c23bf32637b095308ea to your computer and use it in GitHub Desktop.
Some os valores dos objetos
This file contains hidden or 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 = [{ '5': 50, '6': 60 }, { 'A': 10 }, { 'YEEZY': 30 }]; | |
const arrNumbers = () => obj.map(_a => Object.values(_a)); | |
const onlyNumbers = () => [].concat(...arrNumbers()); | |
const result = () => onlyNumbers().reduce((_a, _b) => _a + _b, 0); | |
console.log(result()); // 150 |
This file contains hidden or 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
Some os valores dos objetos | |
Dado o array de dictionary abaixo some o total dos valores | |
[{ '5': 50, '6': 60 }, { 'A': 10 }, { 'YEEZY': 30 }] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment