Skip to content

Instantly share code, notes, and snippets.

@codecademydev
Created December 31, 2020 17:22
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 codecademydev/3b1a06c9cbd25283c65afd52cb5753fc to your computer and use it in GitHub Desktop.
Save codecademydev/3b1a06c9cbd25283c65afd52cb5753fc to your computer and use it in GitHub Desktop.
Codecademy export
// Write your code here:
const reverseArray = () =>{
word = [];
newSentence = [];
for ( i = 0 ; i < sentence.length ; i++){
word = sentence[i];
newSentence.unshift(word);
}
return newSentence;
}
// When you're ready to test your code, uncomment the below and run:
const sentence = ['sense.','make', 'all', 'will', 'This'];
console.log(reverseArray(sentence));
// Should print ['This', 'will', 'all', 'make', 'sense.']
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment