Created
August 14, 2017 13:00
-
-
Save kutyel/7724bf566b9a893c7b8b95b3260550c4 to your computer and use it in GitHub Desktop.
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
| // underscore | |
| _.max(dc, 'power') // quién será el héroe más poderoso? | |
| // nativo | |
| dc.reduce((x, y) => x.power > y.power ? x : y) | |
| // output | |
| // > Object { name: "batman", power: 100 } | |
| // Lo siento Superman, Batman siempre gana! | |
| // underscore | |
| _.min(dc, 'power') // y el más flojo? | |
| // nativo | |
| dc.reduce((x, y) => x.power < y.power ? x : y) | |
| // output | |
| // > Object { name: "greenarrow", power: 70 } | |
| // Pobre Green Arrow, nadie le quiere... |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment