Multiple choice technology web technology

Where is the correct place to insert a JavaScript?

  1. The <body> section

  2. Both the <head> section and the <body> section are correct

  3. The <head> section

  4. None of the above

Reveal answer Fill a bubble to check yourself
B Correct answer
Explanation

JavaScript can be placed in either the or section. While placing scripts at the end of the body is often recommended for performance, both locations are technically valid. The section is useful for functions that should be loaded before the page content.