To access the content of a tag, we need to add  .innerHTML at the end of the document.getElementById() instruction.

Add .innerHTML to display the content of the heading.

<html><head></head><body><h1>Soccer team ratings</h1><h2 id="winner">Liverpool</h2><p>This team has an overall rating of 7.01.</p><h2 id="loser">Lyon</h2><p>This team has an overall rating of 6.91.</p><script>var text = document.getElementById("loser").innerHTML;
console.log(text);</script>
</body>
</html>]]>

Make sure to add .innerHTML to your code.