<script>

window.alert(‘Hello world!’);

</script>

This snippet of code would automatically run on page load, so the prompt would appear right away.

Writing to console

The console is a powerful debugging tool built into all modern browsers. It is a tool to display informative messages about your website. You can push a message to the log by making use of the console.log() method.

Let’s see how it works: