-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathexercicio3.html
More file actions
31 lines (30 loc) · 1.18 KB
/
exercicio3.html
File metadata and controls
31 lines (30 loc) · 1.18 KB
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
<html>
<head>
<meta charset="UTF-8">
<title>Exercício 3</title>
</head>
<body>
<Script>
function temHabilidade(skill) {
var skills = ["Javascript", "NodeJS", "ReactJS", "React Native"];//, habilidades = "";
if (skills.indexOf(skill) > -1) {
return "O programador possui habilidade em " + skill + ".";
}
else{
// for (let i = 0; i < skills.length; i++) {
// if (habilidades.length === 0) {
// habilidades = skills[i];
// }
// else {
// habilidades += ", " + skills[i];
// }
// }
// Em vez de fazer utilizar um FOR, utilizei o metodo Join do Array
return "O programador não possui habilidade em " + skill +
", porem possui habilidades em " + skills.join(", ") + ".";
}
}
console.log(temHabilidade("Delphi"));
</Script>
</body>
</html>