There are six attributes for the <script> element:
|Attribute|| Optional|| Meaning|
|async|| Optional|| script should begin downloading immediately but should not prevent other actions such as downloading resources or waiting for other scripts to load.|
Valid only for external script files.
|charset|| Optional|| The character set of the code specified using the src attribute.|
rarely used, because most browsers don't honor its value.
|defer|| Optional|| execution of the script can safely be deferred until after the document's content has been completely parsed and displayed.|
Valid only for external scripts.
Most browsers ignore this attribute.
|src|| Optional|| an external file that contains code to be executed.|
|type|| Optional|| Replaces language; indicates the content type (MIME type) of the scripting language being used by the code block.|
There are two ways to use the <script> element:
For example, the following code causes an error when loaded into a browser:
The browser sees the string "</script>" as if it were the closing </script> tag.
To fix it, escape the "/" character: