0

i just wanted to know if anyone knows why this small programm does not seem to log anything into the console , i opened the HTML file called index.html in chrome which is using javascript version 1.7 which i checked because i used to implement this small programm on an other computer where it used to work, but this shouldn't make any difference right?

const button = document.querySelector("button");
const input1 = document.getElementById("num1");
const input2 = document.getElementById("num2");

function add(num1, num2) {
  return num1 + num2;
}



button.addEventListener("click", function() {
  console.log(add(input1.value, input2.value));
});
<head>
  <meta charset="UTF-8" />
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
  <meta http-equiv="X-UA-Compatible" content="ie=edge" />
  <title>DoneTroDon</title>
  <script scr="js-only.js" defer></script>
</head>

<body>
  <input type="number" id="num1" placeholder="Number 1" />
  <input type="number" id="num2" placeholder="Number 2" />
  <button>Add!</button>
</body>
tacoshy
  • 5,858
  • 5
  • 9
  • 28

0 Answers0