
In JavaScript, you can write “Hello, World!” in multiple ways. Here are a few common methods:
1. Using console.log (Most Common for Debugging
console.log("Hello, World!");
This prints “Hello, World!” to the browser’s developer console.
2. Using alert (Pop-up Message)
alert("Hello, World!");
This displays a pop-up alert box with “Hello, World!”
3. Using document.write (Writes to the Page)
document.write("Hello, World!");
This writes “Hello, World!” directly onto the webpage.
4. Using DOM Manipulation (innerText or innerHTML)
document.body.innerHTML = "<h1>Hello, World!</h1>";
This inserts “Hello, World!” inside an <h1> tag in the webpage.

January 29, 2025
Your First “Hello World” in Node.js

January 29, 2025