Skip to main content

The script Tag

JavaScript Fundamentals: The "script" Tag

What is the “script” tag used for in JavaScript?

View Answer:
Interview Response: We can use the script tag to insert JS into HTML or import scripts from external sources.

Technical Response: JavaScript may be included practically anywhere in an HTML page using the script tag We use the script tag to import scripts from external file sources.

Code Example:

<script src="/path/to/script.js"></script>
// External URL:
<script src=""></script>