2
I want the loop below is show all even numbers that are smaller or equal to it, but I can only make it 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>