patcko

Untitled

Dec 15th, 2017
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. const arr1 = Array.from({ length: 5 }).map(() =>
  2.     Math.round(Math.random() * 100)
  3. );
  4. let arr2 = [];
  5. for (let i = arr1.length - 1; i >= 0; i -= 1) {
  6.     arr2.push(arr1[i]);
  7.     arr2.unshift(arr1[i]);
  8. }
  9. console.log(arr1);
  10. console.log(arr2);
Advertisement
Add Comment
Please, Sign In to add comment