The aircraft carrier dramatically changed naval combat in World War II, because air power was becoming a significant factor in warfare. The advent of aircraft as focal weapons was driven by the superior range, flexibility and effectiveness of carrier-launched aircraft. They had higher range and precision than naval guns, making them highly effective. The versatility of the carrier was demonstrated in November 1940 when HMS Illustrious launched a long-range strike on the Italian fleet at their base in Taranto, signalling the beginning of the effective and highly mobile aircraft strikes. This operation incapacitated three of the six battleships at a cost of two torpedo bombers. World War II in the Pacific Ocean involved clashes between aircraft carrier fleets. The 1941 Japanese surprise attack on Pearl Harbor was a clear illustration of the power projection capability afforded by a large force of modern carriers. Concentrating six carriers in a single unit turned naval history about, as no other nation had fielded anything comparable. However, the vulnerability of carriers compared to traditional battleships when forced into a gun-range encounter was quickly illustrated by the sinking of HMS Glorious by German battleships during the Norwegian campaign in 1940.
Why were carrier-launched aircraft more effective than naval guns? (If the question is unanswerable, say "unanswerable")
They had higher range and precision