How to use external JavaScript file? code example
Example 1: include js in html
<html>
<head>
</head>
<body>
<script type="text/javascript" src=es4.js></script>
</body>
</html>
Example 2: how to include external javascript in html
<script src="script.js">
Example 3: how to write code in external javascript file
function myFunction() {
document.getElementById("demo").innerHTML = "Paragraph changed.";
}