0
Good afternoon I’m studying Js.
I created a code that shows a list of numbers from 1 to 10 but I do not want my result to show the numbers 2 and 9.
My problem is not knowing how to express this doubt in the research or the name/ term that this my problem fits.
<meta charset="UTF-8">
<script>
function pulaLinha() {
document.write("<br>");
document.write("<br>");
}
function mostra(frase) {
document.write(frase);
pulaLinha();
}
var i = 0
var cont = (i +1);
while (cont <= 10) {
mostra (cont++);
}
</script>
You really need to use the
while
, can’t be afor
?– Pablo Tondolo de Vargas
Good afternoon Pablo. I am studying so on my own I discovered "for" today ( rsrs), so I would like to find a way with while. Grateful
– Gilson Rodrigo
what you need is to use the conditional
If
, Example: If the value is equal to 2 or 9 then do something if you don’t do something else.– Caique Romero