<head> section of your html file.
That means the browser will try to execute this statement
const p_div = document.getElementById("p");
but will fail to do so because the element in question is defined in the
<body> section later on. Try to move the
<script> section to the end of the