Uncaught TypeError: Cannot read properties of null (reading 'addEventListener')
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Color Flipper</title>
<script src="colorflipper.js"></script>
</head>
<body>
<nav>
<div class = "nav-center">
<nav>
</body>
</html>
Solution : Declare the source of script file "colorflipper.js" below or inside the body tag!