After creating JS file, integrate it to the HTML file in the script tag as in below example:
a) Code can be saved and placed in external files also.
b) It separates html and code. This allows designer to work parallel without creating any conflicts.
c) Code becomes easy to manage.
e) These files can be easily cached by browsers, these will increase loading time.
f) We can do error debugging easily.
Waiting for your comments