Maximize the sum of modulus with every Array element | Function to return the maximum sum of modulus with every array element ; Sum of array elements ; Return the answer ; Driver Code
function maxModulosum ( a , n ) { let sum = 0 ; for ( let i = 0 ; i < n ; i ++ ) { sum += a [ i ] ; } return sum - n ; } let a = [ 3 , 4 , 6 ] ; let n = a . length ; document . write ( maxModulosum ( a , n ) ) ;