An included script can access the tags and content of index.html with an object called document.

Display document in the console to see the HTML code inside.

<html>
<body>
  HTML code goes here
  <script src="script.js">console.log(document);</script>
</body>
</html>]]>

Make sure to add document to the code.