You'll see the problem if you open the developer tools window ( SHIFT + CTRL + I) and look at the console output. You get lots of errors like "Identifier 'pElementObject' has already been declared".
The underlying code for that question - which is in the Global Extra field - evaluates the output window on every key event. If you put let thing = 10 in the JS field, you are assigning a value to a global value (i.e. an attribute of the window object). The semantics of let and const prevent reassigning a value to an existing variable, hence your problem.
If instead you get your students to wrap their code in a function, such as:
function myCode() {
let obj = document.getElementById('blah');
obj.innerHTML = "my text string";
}
myCode();
you'd be teaching them good code structure and would avoid the problem :-)
However, if you want to use global code you could instead wrap the code from the JS element in a function as above, or even just in braces, within the Global Extra code.