Find the sum of all the terms in the n | function to find the required sum ; sum = n * ( 2 * n ^ 2 + 1 ) ; Driver program to test above
function sumOfTermsInNthRow ( n ) { let sum = n * ( 2 * Math . pow ( n , 2 ) + 1 ) ; return sum ; } let n = 4 ; document . write ( " " + sumOfTermsInNthRow ( n ) ) ;