Experiencing an issue with a program that finds the greatest out of three numbers and displays it. I think that I don't link the two files properly. Can somebody point out what I'm doing wrong and why it doesn't work? Thanks in advance. The code is written in two separate files - .html and .js.
The code:
let pressedKey = getElementById("button");
pressedKey.addEventListener("click"function() {
  let num1 = Number(document.getElementById("num1").value);
  let num2 = Number(document.getElementById("num2").value);
  let num3 = Number(document.getElementById("num3").value);
  if (num1 > num2 && num1 > num3) {
    window.alert(num1 + " is the greatest!");
  } else if (num2 > num1 && num2 > num3) {
    window.alert(num2 + " is the greatest!");
  } else {
    window.alert(num3 + " is the greatest!");
  }
});
<html>
<head>
  <meta charset="UTF-8">
  <title>Greatest number of 3.</title>
</head>
<body>
  <h1>Calculate the greatest of three numbers!</h1>
  <hr color="cyan">
  <br> Enter number one: <input type="text" id="num1"></input><br> Enter number two: <input type="text" id="num2"></input><br> Enter number three: <input type="text" id="num3"></input><br>
  <hr color="cyan">
  <button id="button">OK</button>
  <script src="greatestNumber.js"></script>
</body>
</html>