Product of all non repeating Subarrays of an Array | Function to find the product of all non - repeating Subarrays of an Array ; Finding the occurrence of every element ; Iterating through the array and finding the product ; We are taking the power of each element in array with the occurrence and then taking product of those . ; Driver Code
function product ( arr ) { let occurrence = Math . pow ( 2 , arr . length - 1 ) ; let product = 1 ; for ( let i = 0 ; i < arr . length ; i ++ ) { product *= Math . pow ( arr [ i ] , occurrence ) ; } return product ; } let arr = [ 10 , 3 , 7 ] ; document . write ( product ( arr ) ) ;