Program for focal length of a lens | Function to determine the focal length of a lens ; variable to store the distance between the lens and the image ; variable to store the distance between the lens and the object
function focal_length ( image_distance , object_distance ) { return 1 / ( ( 1 / image_distance ) + ( 1 / object_distance ) ) ; } let image_distance = 2 ; let object_distance = 50 ; document . write ( " " + focal_length ( image_distance , object_distance ) + " " ) ;