Skip to content

Instantly share code, notes, and snippets.

@gokhanbarisaker
Created January 2, 2015 12:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gokhanbarisaker/9da20471da2e679fd710 to your computer and use it in GitHub Desktop.
Save gokhanbarisaker/9da20471da2e679fd710 to your computer and use it in GitHub Desktop.
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(', ');
}
@gokhanbarisaker
Copy link
Author

UD 804, What's next, Astronauts Arrays problem

References;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment