-
Notifications
You must be signed in to change notification settings - Fork 191
Expand file tree
/
Copy pathFind.js
More file actions
18 lines (16 loc) · 405 Bytes
/
Find.js
File metadata and controls
18 lines (16 loc) · 405 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
pessoas = [];
pessoas.push({"nome": "Pedro"})
pessoas.push({"nome": "João"})
pessoas.push({"nome": "Maria"})
pessoas.push({"nome": "José"})
function encontrar() {
for (let pessoa of pessoas) {
if (pessoa.nome === 'Pedro') {
console.log('Já existe');
return;
}
}
console.log('Não existe');
}
encontrar()
//https://pt.stackoverflow.com/q/339983/101