Minimum area of square holding two identical rectangles | Function to find the area of the square ; Larger side of rectangle ; Smaller side of the rectangle ; Driver Code
function areaSquare ( L , B ) { let large = Math . max ( L , B ) ; let small = Math . min ( L , B ) ; if ( large >= 2 * small ) { return large * large ; } else { return ( 2 * small ) * ( 2 * small ) ; } } let L = 7 ; let B = 4 ; document . write ( areaSquare ( L , B ) ) ;