Newbie question based on Simply Javascript book

I’ve got the html and i’ve linked to a script

<!DOCTYPE html>
<html lang="en">

<head>
	<script type="text/javascript" src="script.js"></script>
	<title>Hello</title>
</head>

<body>

    <h1>This is some header</h1>
    
    <p>
        Lorem ipsum dolor sit amet, consectetur adipiscing elit. 
        In id odio sapien, vitae consectetur ante. Ut eget nisl magna. 
        Aliquam risus enim, mollis sed venenatis quis, feugiat a augue. 
        Aliquam et <a href="#" id="berenger">libero</a> quam, nec sollicitudin ipsum. 
    </p>

</body>
</html>

Here’s script.js


var target = document.getElementById('berenger');
alert(target.nodeName);

Why isn’t the alert box appearing when i load the page?
I’m trying out the example in chapter 3 where we learn to access the element node using the id by using getElementById method.

The page is processed sequentially. This means that when the script in the head runs, the rest of the page does not yet exist.

Move the script to just before the </body> tag so that the script can then successfully work with page elements.

Thanks pmw57. I managed to get it to work