Scripts can also be placed in external files. External scripts are practical when the same code is used in many different web pages. JavaScript files have the file extension .js. You can place an external script reference in <head> or <body> as you like. The script will behave as if it was located exactly where the <script> tag is located. To use an external script, put the name of the script file in the src (source) attribute of the <script> tag: