javascript newbie here. I was trying to add 2 numbers via user input but the code returns a NaN warning in the console. I know other methods to do this but i wanted to it with the ES6 Features.
//HTML
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
<form>
<input type="number" name="num1" id="num1">
<input type="number" name="num2" id="num2">
<button type="submit" value="+">+</button>
<input type="number" name="num3" id="num3">
</form>
<script src="calculator.js"></script>
</body>
</html>
//JAVASCRIPT
const num1 = parseInt(document.querySelector('#num1').value);
const num2 = parseInt(document.querySelector('#num2').value);
const num3 =Number(document.querySelector('#num3').value);
const form = document.querySelector('form');
form.addEventListener('submit', e =>{
e.preventDefault();
const c = num1 + num2;
form.num3.value = c;
});