Storing sum of array arr [ ]
let sum_arr = 0 ; for ( let i = 0 ; i < N ; i ++ ) { sum_arr = sum_arr + arr [ i ] ; } if ( sum_arr >= N ) document . write ( sum_arr - N + " " ) ; else document . write ( 1 + " " ) ; }