Prewar, the only way to detect an incoming enemy air attack was visually, which sometimes left little or no time to intercept an incoming raid. Think Midway. Therefore, the prewar thought was to some extent that carriers could not reliably be defended, and so the emphasis (for the USN and IJN, anyway) was to maximize the offense so that their carriers could accomplish something before being crippled or sunk. Eggshells armed with hammers.
With the introduction of radar, enemy aircraft could be detected at a much longer distance, but it still took time to perfect fighter direction, so initially there were situations where intercepting fighters were sent to the wrong place, and so the defensive ability of carriers was still somewhat limited.
Later, Allied fighter direction became very good, and intercepting enemy aircraft long before they came near the carriers allowed carriers to have very formidable defensive ability. Think Battle of the Philippine Sea.
In response to the late war US ability to knock down Japanese aircraft in droves, the Japanese began introducing infiltration attacks, where instead of massing their attacks, they would often send only a few aircraft at a time into Allied airspace, taking advantage of the fact that the vast majority of aircraft heading towards the US carriers were in fact US planes returning from missions. By attempting to infiltrate in this manner, this forced the US to detect, track, identify, and potentially intercept every single inbound aircraft, not a trivial task. This forced the US into deploying picket destroyers, and hurrying up the development of height finding radars, to ensure that intercepting fighters were sent to the right place at the right altitude.
So the defensive capabilities of Allied carriers increased dramatically over the course of the war, above and beyond just the increase in the number of carriers and carrier aircraft.
Vlad wrote:
I think the fact the battleships were not committed shows that views over the role of carriers was conflicted. It's almost like carriers were expendable and battleships to be saved at all cost.
Alternatively, I think both sides decided that that bringing battleships to a carrier fight was like bringing a knife to a gun fight. Not a good idea. After Midway, for example, the Japanese converted the Shinano into a carrier, converted the Ise class into hybrids, relegated the Fuso and Nagato classes to training, and went on a carrier (not battleship) building frenzy. They clearly understood at that point that the day of the battleship had passed.