Created
January 21, 2019 08:20
-
-
Save rxluz/0b2216d017f8e3aa09169e846a8abd12 to your computer and use it in GitHub Desktop.
JS Data Structures: Arrays, see more at: https://medium.com/p/e1bc57bda950
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
const animals = ["elephant", "monkey", "snake", "lion"]; | |
for (let index = animals.length; index > 0; index--) { | |
animals[index] = animals[index - 1]; | |
} | |
animals[0] = "macaw"; | |
console.log(animals); // will return [ 'macaw', 'elephant', 'monkey', 'snake', 'lion' ] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment