Last active
July 9, 2017 19:09
-
-
Save matheusdavidson/599780bcd2d579639c8da2016ee12e0c 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
let _ = require('lodash'); | |
let games = [{ | |
name: 'Street Fighter', | |
year: 1990 | |
}, | |
{ | |
name: 'Mortal Kombat', | |
year: 1991 | |
}, | |
{ | |
name: 'Top Gear', | |
year: 1992 | |
} | |
] | |
// | |
// Crescente | |
let result = _.sortBy(games, ['name']); | |
// | |
// Decrescente | |
// let result = _.sortBy(games, ['name']).reverse(); | |
console.log(result); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment