JavaScript is inserted into HTML pages by using the <script> element. This element can be used
to embed JavaScript into an HTML page, leaving it inline with the rest of the markup, or to include
include, which may be a file on the same server as the containing page or one that exists on
a completely different domain.
➤ All <script> elements are interpreted in the order in which they occur on the page. The
code contained within a <script> element must be completely interpreted before code in
the next <script> element can begin so long as defer and async attributes are not used.
<script> elements are usually included toward the end of the page, after the main content
document rendering by using the async attribute. Asynchronous scripts are not guaranteed
to execute in the order in which they occur in the page.
rendered if scripting is enabled on the browser.
to embed JavaScript into an HTML page, leaving it inline with the rest of the markup, or to include
JavaScript that exists in an external fi le. The following are key points:
include, which may be a file on the same server as the containing page or one that exists on
a completely different domain.
➤ All <script> elements are interpreted in the order in which they occur on the page. The
code contained within a <script> element must be completely interpreted before code in
the next <script> element can begin so long as defer and async attributes are not used.
➤ For nondeferred scripts, the browser must complete interpretation of the code inside
a <script> element before it can continue rendering the rest of the page. For this reason,<script> elements are usually included toward the end of the page, after the main content
and just before the closing </body> tag.
attribute. Deferred scripts always execute in the order in which they are specified.
document rendering by using the async attribute. Asynchronous scripts are not guaranteed
to execute in the order in which they occur in the page.
By using the <noscript> element, you can specify that content is to be shown only if scripting
support isn’t available on the browser. Any content contained in the <noscript> element will not berendered if scripting is enabled on the browser.
From:Professional JavaScript for Web Developers (2012)