In JavaScript, printing generally means displaying output. Depending on where you want the output to appear, you can use several methods:
Use console.log():
console.log("Hello, World!");
This shows in the browser’s developer console.
Use document.write() (not recommended for modern apps, but still useful for quick demos):
document.write("Hello, World!");
Or modify an element on the page:
<code><p id="output"></p>
<script>
document.getElementById("output").innerText = "Hello, World!";
</script></code>
Use window.print():
window.print();
Work with our skilled Javascript developers to accelerate your project and boost its performance.
Hire JavaScript Developers