Goals of the battle of midway:
Japan:
"A dizzying string of Japanese successes that fed what historians later labeled 'victory disease'"(Symonds, p. 42) led Japan to plan an attack on the United States to make sure that they did not interfere with their agenda. Japan also saw that if they took over Midway the United States would lose contact with Australia forcing Australia out of the war. Additionally if they controlled Midway they would be controlling all of Eastern Asia and then be ruling the Pacific.
United States:
The United States were able to crack the code and find out Japan's plans to attack them and be prepared to ambush them. So their main goal was to maintain control over Midway so that Japan did not get control over all of the Pacific.
"A dizzying string of Japanese successes that fed what historians later labeled 'victory disease'"(Symonds, p. 42) led Japan to plan an attack on the United States to make sure that they did not interfere with their agenda. Japan also saw that if they took over Midway the United States would lose contact with Australia forcing Australia out of the war. Additionally if they controlled Midway they would be controlling all of Eastern Asia and then be ruling the Pacific.
United States:
The United States were able to crack the code and find out Japan's plans to attack them and be prepared to ambush them. So their main goal was to maintain control over Midway so that Japan did not get control over all of the Pacific.