Which of the following is a valid method to apply an external JavaScript file…
2025
Which of the following is a valid method to apply an external JavaScript file to an HTML document ?
- A.
<script href="file.js">
- B.
<script src="file.js">
- C.
<javascript src="file.js">
- D.
<script file="file.js">
Attempted by 62 students.
Show answer & explanation
Correct answer: B
The correct method to apply an external JavaScript file is using the src attribute within a script tag, as shown in option 2.