Fortunately the Japanese were sighted at the last minute and we were able to engage them while many of their own planes were on deck being refitted with bombs and ammuniiton, and being refuelled. Thus the Japanese carriers were at their most vulnerable when we caught them. They started the day with five carriers, and at the end of the day they had one, the Hiryu, which had initially been kept in reserve.
Still, the actual island base of Midway was heavily damaged by Japanese raids, and the victory, as decisive as it was, was a near thing.
That timing was crucial. The carriers were getting ready to launch and had reserves brought up abovedeck.