-2
I’m trying to stop a loop for when the number 42 is typed. Even my code is like this:
var numero = prompt('Digite o numero')
var arrNumero = []
arrNumero.push(numero)
console.log(arrNumero)
for (let i = 0; i < arrNumero.length; i++) {
if (arrNumero[i] === '42') {
break;
} else {
console.log(arrNumero[i])
}
}
When you enter the number 42 for no stop with the break instruction. I would like to know from you how to not print the number 42 on the console.
From what I understand, it wouldn’t just be removing the console.log. Below the line :
arrNumero.push(numero)
?– Danizavtz