Created
July 31, 2018 19:06
-
-
Save wojtrawi/97010ef6a4aa6419fcfffe035cdd7ca7 to your computer and use it in GitHub Desktop.
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
const cars = [ | |
'Aston Martin', | |
'Ferrari', | |
'Porsche' | |
]; | |
const carsCopy = [...cars]; | |
const carsReversed = []; | |
while (carsCopy.length) { | |
carsReversed.push(carsCopy.pop()); | |
} | |
console.log(`My cars: ${cars}`); | |
console.log(`My cars reversed: ${carsReversed}`); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment