Advertisement
Spocoman

08. Condense Array to Number

Jan 21st, 2022
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function solve(arr) {
  2.  
  3.     for (let i = 0; i < arr.length - 1; i++) {
  4.         for (let j = 0; j < arr.length - 1; j++) {
  5.             arr[j] += arr[j + 1];
  6.         }
  7.         arr.pop();
  8.         i--;
  9.     }
  10.     console.log(arr[0]);
  11. }
  12.  
  13.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement