Advertisement
silvana1303

process odd numbers

Apr 9th, 2021
468
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function  solve(arr){
  2.  
  3.     let arrNew = [];
  4.  
  5.     for (const index in arr) {
  6.         if (index % 2 == 1){
  7.             arrNew.push(arr[index]*2);
  8.         }
  9.     }
  10.  
  11.  
  12.     console.log(arrNew.reverse().join(' '));
  13. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement