Sum of all elements up to Nth row in a Pascal triangle | Function to find sum of all elements upto nth row . ; Initialize sum with 0 ; Calculate 2 ^ n ; Driver Code
function calculateSum ( n ) { sum = 0 ; sum = 1 << n ; return ( sum - 1 ) ; } let n = 10 ; document . write ( " " + calculateSum ( n ) ) ;