-
-
Save codecademydev/c025e73cb3741b57d11069ea63d7a272 to your computer and use it in GitHub Desktop.
Codecademy export
This file contains 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
// Write your code here: | |
function reverseArray(array){ | |
let newArray =[]; | |
array.forEach(element => newArray.splice(0,0,element)); | |
return newArray; | |
}; | |
// 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