Home / Programs / Writing into the HTML output using Javascript
Programming Example

Writing into the HTML output using Javascript

👁 335 Views
💻 Practical Program
📘 Step by Step Learning
Writing into the HTML output

Program Code

<!DOCTYPE html>
<html>
<body>

<h2>document.write()</h2>
<p>My first paragraph.</p>

<p>Never call document.write after the document has finished loading.
It will overwrite the whole document.</p>

<script>
document.write(5 + 6);
</script>

</body>
</html> 

Output

no

Explanation

no

How to learn from this program

First read the algorithm, then study the program code line by line. After that, compare the code with the output and finally go through the explanation. This approach helps learners understand both the logic and the implementation properly.