I want the loop below to show all even numbers that are less than or equal to it, but I can only get it to show the last number. If I type 40 and it returns only 2.
<div class="calculo">
<input type="number" id="num1" placeholder="Informe o primeiro número: ">
<button onclick = "pares()">Numeros Pares</button>
<div id="resp"></div>
<script>
function pares(){
var result = "";
var num1 = parseInt (document.getElementById ("num1").value);
for (num1 / 2 == 0; num1 > 0; num1 = num1 - 2) {
document.getElementById("resp").innerHTML = num1;
}
}
</script>
</div>