How to link javascript to HTML?

You have a few options for linking Java Script with HTML.

1. External File:
<body>
<script src="script.js"></script>
</body>

2. Internal Script Tag :
<body>
<script>
console.log('Hello, world!');
</script>
</body>"

Go from files to website in seconds.

Start a free trial for 7 days — no credit card required

Get Started for Free