Within <head> tag
Within <body> tag
For example, if the following content is already written in the file_name.js file the function Show can be invoked in your HTML file after including the file_name.js file.
Note: The correct path (using ./ or ../ in front of the filename in src attribute) should be mentioned while including the external .js file otherwise it will throw an error and the file will not be included into the current HTML script.
Placing scripts in external files is more advantageous than that of in an internal file:
External scripts can be included with a full URL which is known as Absolute path. Consider the following example:
External scripts can also be referenced with a path relative to the current web page which is known as Relative path. Consider the following example: