Good question.
If the Battle of Midway had happened 100 times, the Americans would have lost at least 90 of them.

The American carrier task force escaped detection by pure

luck. The Japanese launched 12 reconnisance sorties to find the American fleet. It just so happened that the one sortie which would have found it experienced engine trouble and had to return early.

The DD dive bombers that sank the Japanese carriers were only allowed clear skies due to the unrelated suicidal mission by the American torpedo bombers which pulled all the Zeroes from the skies towards sea level.

Basically, every little accident, even American mistake, came together in just the right way to make the battle a total American victory.

As to how it would affect the war, well obviously Midway would have been lost and the perimeter would have to pulled back to Hawaii itself. It's unsure if the Japanese would have gone ahead with an invasion of Hawaii but its certainly within the realm of possibility.

Defending Australia and New Zealand would also have been far more challenging without the support of the American carrier group.

But ultimately, the war would still have been an American victory. Japan simply lacked the resources to keep up the effort against the Americans for long regardless of how many initial victories.