Guest User

Untitled

a guest
Jan 21st, 2019
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.26 KB | None | 0 0
  1. const animals = ["elephant", "monkey", "snake", "lion"];
  2.  
  3. for (let index = animals.length; index > 0; index--) {
  4. animals[index] = animals[index - 1];
  5. }
  6.  
  7. animals[0] = "macaw";
  8.  
  9. console.log(animals); // will return [ 'macaw', 'elephant', 'monkey', 'snake', 'lion' ]
Add Comment
Please, Sign In to add comment