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="https://cdnjs.cloudflare.com/ajax/libs/lodash.js/4.17.11/lodash.js"></script>