Multiple choice technology web technology

Where is the correct place to insert a JavaScript in HTML Page?

  1. The <head> section

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

  3. The <body> section

  4. The <metadata> section

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

JavaScript can be placed in either the or section of an HTML page, making option B correct. Scripts in the section execute before the page renders (useful for early initialization), while scripts in the section can manipulate DOM elements as they load. The choice depends on when the JavaScript needs to run and whether it needs to access specific DOM elements. Option D is incorrect because there is no standard section in HTML.