Well, the call of the function is coming without the parameters n1 and N2, but still it would result in error, because the point is that every time you click on the button it should bring the new values of number1 and number2 to n1 and N2 and this is not happening here.
So to get around this situation I created a arrowfunction and so that every time the button is clicked it fetches the value of number1 and number2, assigns in n1 and N2 and makes the calculation of the average assigning in the average variable and finally being written in the document with Document.write.
HTML
<input type="number" name="numero1" id="number1">
<input type="number" name="numero2" id="number2">
<button>media</button>
JAVASCRIPT
var numero1 = document.querySelector("#number1");
var numero2 = document.querySelector("#number2");
var botao = document.querySelector("button");
botao.onclick = () => {
var n1 = Number(numero1.value);
var n2 = Number(numero2.value);
var media = (n1 + n2) / 2;
document.write("Média: " + media);
}
Test the code on:
https://jsfiddle.net/veo9fj6y/