The page you refer to has the following code:
<p id="p1">Hello, guest!</p> <script> ... var username = searchParams.get('name'); ... document.getElementById('p1').innerHTML = 'Hello, ' + username + '!';
Your expectation is, that setting username to
<script>alert(1)</script> should result in
<p id="p1">Hello, <script>alert(1)</script></p> which should in your opinion result in the script getting executed.
But this is not the case. The documentation of
Element.innerHTML explains why:
HTML5 specifies that a
<script>tag inserted with innerHTML should not execute.
Immediately preceding this statement there is also an example which is similar to yours to illustrate this.