The flexibility of using JavaScript anywhere in an HTML document.
1→ script in the head section.
2→ script in the body section.
3→ script in both head and body sections.
{getToc} $title={Table of Contents}
JavaScript Introduction Part 1: Checkout
Example 1 :
<html> <head> <script> document.write("this is inside head"); </script> <body> </body> </head> </html>
Output :
this is inside head
Example 2:
<html> <head> <body> <script> document.write("this is inside body"); </script> </body> </head> </html>
Output :
this is inside the body
Example 3 :
<html> <head> <script> document.write("this is inside head"); </script> </head> <body> <script> document.write("this is inside body"); </script> </body> </html>
Output :
this is inside head
this is inside the body