05 October, 2020
The script tag takes two important attributes Language
Let us write our class example to print out “Hello World”.
Next, we call a function document .write which writes a string into our HTML document. This function can be used to write text, HTML, or both. So the above code will display the following result: Hello World! Whitespace and Line Breaks
Semicolons are optional
Note It is a good programming practice to use semicolons.
Script in <head> … </head> section
Script in <body> … <.body>
Section Script in <body> …. </body>
and <head> ….. </head> sections.
Script in and external file and then include in <head>--- </head> section.
If you want to have a script run on some event, such as when a user clicks somewhere, then you will place that script in the head as follows:
TekSlate is the best online training provider in delivering world-class IT skills to individuals and corporates from all parts of the globe. We are proven experts in accumulating every need of an IT skills upgrade aspirant and have delivered excellent services. We aim to bring you all the essentials to learn and master new technologies in the market with our articles, blogs, and videos. Build your career success with us, enhancing most in-demand skills .