External JavaScript File:

1) We can create separate javascript file with .js extension.
2) We can use that file for multiple html pages.
3) It provide code re-usability and increases speed of execution.
4) Syntax: demo.js

function demo() {

  alert("example demo");
}

Code:

External.html


External.js


Output:


After clicking Login button: