Let's start with the classic "Hello, World!" example:
// Display "Hello, World!" in the browser's console
Open this HTML file in a web browser, and you'll see "Hello, World!" in the browser's console.
- Inline: Inside a
<script>tag within the HTML file, as shown in the previous examples.
- External: In a separate
.jsfile linked to the HTML file using the
And the content of
console.log("Hello from an external script!");