We entered the war with six fleet carriers, two in the Atlantic and four in the Pacific, and soon transferred one from the Atlantic to the Pacific.
The Japanese thought they had sunk two at Coral Sea, with a third in dry dock following Wake Island. This left us with two, they thought. The main purpose of their attack on Midway was to draw out the American fleet and destroy what remained of it.
They had some problems amassing their own forces, with the attack on the Aleutians and losses - including pilots and aircraft - at Coral Sea. For lack of pilots and aircraft, it was an easy decision for them to leave one of their fleet carriers in dry dock and send “only” four to Midway. Still, four flattops should have been enough.
In large measure, we won the Battle of Midway because the Yorktown was quickly returned to service, giving us three flattops.
The greatest factor was possibly our intelligence operations.
Other key ingredients were the failure of Operation K, Nagumo’s refusal to commit fighter planes to search missions,
and not knowing where American forces were or how many carriers we had deployed.
Actually, on December 7, 1941 there were seven fleet carriers plus two, in effect, escort carriers.
Of those, in the Pacific:
In the Atlantic: