Sum of digits for each element in vector
for ( let i = 0 ; i < a . length ; i ++ ) { let c = 0 ; while ( a [ i ] > 0 ) { c += ( a [ i ] % 10 ) ; a [ i ] = Math . floor ( a [ i ] / 10 ) ; } a [ i ] = c ; } return a ; }