<head>, before the body of your HTML Is loaded. Therefore your line
const guessSubmit = document.querySelector('.guessSubmit');
Has nothing to look up – your button with class
guessSubmit doesn’t exist yet. And since
guessSubmit is null, it does not contain any properties, hence the error.
The easiest solution is to put your
Alternative ways include adding event listeners to run your script after the DOM is loaded, such as
DOMContentLoaded. See more here: https://developer.mozilla.org/en-US/docs/Web/Events/DOMContentLoaded.