-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathestrela.html
More file actions
35 lines (22 loc) · 702 Bytes
/
Copy pathestrela.html
File metadata and controls
35 lines (22 loc) · 702 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
<meta charset="UTF-8">
<h1>Receitas do Yan</h1>
<script>
var ingredientes = [];
var quantidade = parseInt(prompt("Quantos ingredientes você vai adicionar?"));
var contador = 1;
while( contador <= quantidade) {
var ingrediente = prompt("Informe o ingrediente " + contador);
var existe = false;
for( var posicao = 0; posicao < ingredientes.length; posicao++) {
if( ingredientes[posicao] == ingrediente) {
existe = true;
break;
}
}
if( existe == false) {
ingredientes.push(ingrediente);
contador++;
}
}
console.log(ingredientes);
</script>