Ad
  • Custom User Avatar

    you're reversing the number which is now an array split into each digit. by reversing it you start from the 1's digit allowing you to increase digits with the index, so since we are increasing by digit, we can multiply by whatever 10 ^ i. the filter is simply filtering out the cases where the digit is 0, like in 2034 you would filter out the hundreds digit because if you didn't, the return would be 2000 + 000 + 30 + 4.