The script element has the following eight properties async: Optional. Indicates that you should start downloading the script immediately, but you cannot prevent other page actions, such as downloading resources or waiting for other scripts to load. This applies only to external script files. Charset: optional. The code character set specified with the SRC attribute. This property is rarely used because most browsers don’t care about its value. Crossorigin: optional. Configure CORS Settings for related requests. CORS is not used by default. Defer: optional. Indicates that the script can be deferred until the document is fully parsed and displayed. This is valid only for external scripts. Integrity: optional. The permission assesses the received resource with the specified cryptographic signature to verify child resource integrity. If the signature of the received resource does not match the signature specified by this property, an error is reported and the script is not executed. This property is used to ensure that content distribution networks do not serve malicious content. Language: the abandoned. A deprecated scripting language originally used to represent code blocks. SRC: optional. Represents an external file that contains the code to execute. Type: optional. Instead of language, represents the content type of the scripting language in the code block. Practice for text/javascript
Putting all the script files in the head tag means that all the JavaScript code must be downloaded and interpreted before the page can be rendered. For pages that require a lot of JavaScript, this causes a significant delay in page rendering, during which the browser window is completely blank. It is now common to place all JavaScript references after the page content in the body tag element.
2.2 Internal Code and External Files It is recommended to place script in external files for the following reasons: 1. Maintainability 2. Cache 3. Future-proofing