Skip to content

Instantly share code, notes, and snippets.

@AdrianSkar
Created October 16, 2022 15:39
Show Gist options
  • Save AdrianSkar/78edf950b5cb12e7549993f189075389 to your computer and use it in GitHub Desktop.
Save AdrianSkar/78edf950b5cb12e7549993f189075389 to your computer and use it in GitHub Desktop.
reversed and sortered Array of names
const people = [
'Bernhard, Sandra',
'Bethea, Erin',
'Becker, Carl',
'Bentsen, Lloyd',
'Beckett, Samuel',
'Blake, William',
'Berger, Ric',
'Beddoes, Mick',
'Beethoven, Ludwig',
'Belloc, Hilaire',
'Begin, Menachem',
'Bellow, Saul',
'Benchley, Robert',
'Blair, Robert',
'Benenson, Peter',
'Benjamin, Walter',
'Berlin, Irving',
'Benn, Tony',
'Benson, Leana',
'Bent, Silas',
'Berle, Milton',
'Berry, Halle',
'Biko, Steve',
'Beck, Glenn',
'Bergman, Ingmar',
'Black, Elk',
'Berio, Luciano',
'Berne, Eric',
'Berra, Yogi',
'Berry, Wendell',
'Bevan, Aneurin',
'Ben-Gurion, David',
'Bevel, Ken',
'Biden, Joseph',
'Bennington, Chester',
'Bierce, Ambrose',
'Billings, Josh',
'Birrell, Augustine',
'Blair, Tony',
'Beecher, Henry',
'Biondo, Frank',
];
let orderedPpl = people.sort().map(val =>{
return val.split(', ').reverse().join(', ');
});
console.log(orderedPpl);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment