Product of all Subsets of a set formed by first N natural numbers | Function to find the product of all elements in all subsets in natural numbers from 1 to N ; Driver Code
function product ( N ) { let ans = 1 ; let val = Math . pow ( 2 , N - 1 ) ; for ( let i = 1 ; i <= N ; i ++ ) { ans *= Math . pow ( i , val ) ; } return ans ; } let N = 2 ; document . write ( product ( N ) ) ;