Find bitwise AND ( & ) of all possible sub | function to return AND of sub - arrays ; Driver code ; size of the array ; print and of all subarrays
function AND ( a , n ) { let ans = a [ 0 ] ; for ( let i = 0 ; i < n ; ++ i ) ans &= a [ i ] ; return ans ; } let a = [ 1 , 2 , 3 ] ; let n = a . length ; document . write ( AND ( a , n ) ) ;