Created
January 2, 2015 12:16
-
-
Save gokhanbarisaker/9da20471da2e679fd710 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
var moonWalkers = [ | |
"Neil Armstrong", | |
"Buzz Aldrin", | |
"Pete Conrad", | |
"Alan Bean", | |
"Alan Shepard", | |
"Edgar Mitchell", | |
"David Scott", | |
"James Irwin", | |
"John Young", | |
"Charles Duke", | |
"Eugene Cernan", | |
"Harrison Schmitt" | |
]; | |
function alphabetizer(names) { | |
// Your code goes here! | |
var alphabetizedNames = []; | |
for (var nameIndex in names) { | |
alphabetizedNames.push(alphabetize(names[nameIndex])); | |
} | |
return alphabetizedNames; | |
} | |
function alphabetize(name) { | |
return name.split(' ').reverse().join(', '); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
UD 804, What's next, Astronauts Arrays problem
References;