What happens when the JavaScript code runs?

The heading's text updates to EasyEcoThe paragraph's text updates to EasyEcoThe heading's text only gets retrieved so nothing happens<html>
<body>
<h2 id="name">Smart Recycling</h2>
<p>Small changes, big impact</p>
<script>
var title = document.getElementById("name");
title.innerHTML = "EasyEco";
</script>
</body>
</html>]]>

When the JavaScript code runs, it updates the heading's text to EasyEco.