Reduce the array to a single element with the given operation | Function to return the final element ; Driver code
function getFinalElement ( n ) { let finalNum ; for ( finalNum = 2 ; finalNum * 2 <= n ; finalNum *= 2 ) ; return finalNum ; } let N = 12 ; document . write ( getFinalElement ( N ) ) ;