Skip to content

Commit c4f19cc

Browse files
committed
Day 06 vowel counter finished
1 parent 8a5f052 commit c4f19cc

File tree

4 files changed

+74
-1
lines changed

4 files changed

+74
-1
lines changed

day06/css/styles.css

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
*{
2+
margin: 0;
3+
box-sizing: border-box;
4+
}
5+
body{
6+
background-color: #3B3B98;
7+
}
8+
.container{
9+
background-color: white;
10+
color: black;
11+
width: 40%;
12+
margin: 10em auto;
13+
padding: 3em;
14+
border-radius: 10px;
15+
}
16+
input{
17+
width: 60%;
18+
border: none;
19+
border-bottom: 1px solid orange;
20+
outline: none;
21+
}
22+
.button{
23+
padding: 0.5em 1em;
24+
background-color: blueviolet;
25+
color: white;
26+
outline: none;
27+
border-radius: 5px;
28+
border: none;
29+
}
30+
.result{
31+
margin-top: 3.5rem;
32+
text-align: center;
33+
font-size: 2rem;
34+
font-weight: bold;
35+
}

day06/script.js

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
let button = document.querySelector(".button");
2+
const word = document.querySelector(".input");
3+
4+
5+
button.addEventListener("click", count);
6+
7+
function count(){
8+
let result = document.querySelector(".result");
9+
let wordVal = word.value.toLowerCase();
10+
let countVowels=0;
11+
for (let index = 0; index < wordVal.length; index++) {
12+
//if(word[index] === 'a'|| word[index] === 'e' || word[index] === 'i' || word[index] === 'o' || word[index] === 'u'){
13+
if(wordVal[index].match(/([a,e,i,o,u])/)){
14+
countVowels++;
15+
16+
}
17+
18+
}
19+
result.innerHTML = "La cantidad de vocales en la palabra es " + countVowels;
20+
}

day06/vowel-counter.html

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8">
5+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
6+
<title>Contador de Vocales</title>
7+
<link rel="stylesheet" href="./css/styles.css">
8+
</head>
9+
<body>
10+
<main class="container">
11+
<h2>Contador de vocales</h2>
12+
<input class="input" type="text" placeholder="Ingrese una palabra" autofocus>
13+
<button class="button">Cuenta</button>
14+
<p class="result"></p>
15+
</main>
16+
<script src="script.js"></script>
17+
</body>
18+
</html>

index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ <h2 class="center">Dias 1-20</h2>
2929
<a href="./day05/palindrome-checker.html">Dia 5</a>
3030
</div>
3131
<div class="align">
32-
<a href="">Dia 6</a>
32+
<a href="./day06/vowel-counter.html">Dia 6</a>
3333
</div>
3434
<div class="align">
3535
<a href="">Dia 7</a>

0 commit comments

Comments
 (0)