-1
Hello, Everybody!
Can you help me with the code below?
I would like it to return a list of all even numbers entering inputs.
document.querySelector("#btnNumPar").addEventListener("click", function() {
const inputNumUm = document.querySelector("#inputNumPar").value.trim();
const inputDoisNum = document.querySelector("#inputNumParDois").value.trim();
let todosPares=[];
for (let i = 0; i <= inputDoisNum; i++) {
if (i % 2 === 0) {
todosPares.push();
console.log(todosPares)
// alert(`Os números pares entre ${inputNumUm} e ${inputDoisNum} são: ${todosPares}`);
}
}
})
You need to tell the push method what you want to insert into the array!
– bfavaretto