On June 3, 1942 Japan's goal was to remove the United States from the pacific power in order to gain territory in east Asia. Japan hoped to defeat the US aircraft so they can take over the region.
On June 4, 1942 four aircraft from Japan attacked the US base on the island of Midway in the North Pacific and heavily damaged it. When the aircraft were returning for refuel, the Japanese navy became aware of the US forces. The US started to attack Japanese aircraft carriers.
Over the next 2 days, the US continued to attack Japan until they finally retreated after losing about 3,000 men, four aircrafts and one aircraft carrier, while the US lost 300 men and one aircraft carrier.